WordPress archive page AdSense error AvailableWidth=0: the whole process of checking from the horizontal scroll bar to the Gutenberg block structure

图 4:控制台出现 availableWidth=0

From Classical to Block: Theme Migration

From Hueman to Twenty Twenty-Five, Topic Switching with Multilingual Menu Configuration

(1) From Hueman to Twenty Twenty-Five, Topic Switching with Multilingual Menu Configuration

经过以上步骤,语言切换器最终在页面上的效果符合预期。(见图 9)

(2) In a WordPress 2025 topic, move the Polylang language switch to the full record in the upper right corner

页眉导航宽度异常问题:导航被内容宽度限制(图 4)

(3) WordPress Twenty Twenty-Five Global Width Layout Practical Notes: Widescreen Full-Scale + Large Screen Limited Wide Configuration Scheme

中文(中国)前台首页:66主内容文章+33标准化侧边栏,区块正常显示(对应图6)

(4) Practice|WordPress Twenty-Five Block Theme Text Blog Home Transform the Classic Two-Column Homepage

改造完成最终首页效果(图5)

(5) WordPress Twenty Twenty-Five Two-column homepage transformation: Text Blog Small picture list template complete practical record

图11:样式重写后下拉美观,但层级子分类在原生 Option 标签下以空格缩进表示

(6) Debugging record of the beautification and rendering mechanism of the drop-down menu of the category list

图3:应用修正后的 CSS,日历占据了应有的侧边栏宽度,有文章的日子用主题同色系进行了高亮,悬停时会变黑

(7) Fixed the issue of “getting dissatisfaction” in the sidebar: WordPress 2025 theme calendar style optimization

图5:English 下的页面显示第二个 Language Visibility 区块

(8) Add the multi-language “Personal Brand” block to the sidebar of the blog homepage

图4:调整后的分页效果

(9) Troubleshooting and Repair of One FSE Page Loss: From Pure Layout Template to Query Loop

在英文页面(https://www.shuijingwanwq.com/en/)中,日历上每个日期点击后跳转的链接仍然是 https://www.shuijingwanwq.com/2026/06/08/ 的形式,而不是预期的 https://www.shuijingwanwq.com/en/2026/06/08/。

(10) WordPress 2025 Theme + Polylang: Fix a full record of the missing language directory for the calendar link

图4:中文站点,下拉菜单样式美观,显示“选择年份”。

(11) Optimize WordPress 2025 Themeser: A complete remodeling record of multilingual navigation, social links and archive drop-down bars

图2:分类页单栏效果

(12) From single column to two columns: the practical record of the sidebar and list structure of the WordPress category page unified first page

套用上述代码后,标签云立刻有了质的飞跃:

(13) Say goodbye to uneven! Create a modern label cloud for 2025 themes only with CSS

搜索“alipay”的结果,每篇文章都带了一张大尺寸的特色图片,紧跟着就是完整的正文内容。我的文章里还有代码片段,全都被拉出来显示在列表里,页面无限拉长,排版也乱糟糟的。如图1

(14) Is the search result page too long? I did a “break away” for the WordPress 2025 theme

在英文页面 https://www.shuijingwanwq.com/en/ 中,22 号显示蓝色链接

(15) Compatibility restoration practice of WordPress calendar in Polylang multi-language environment

Network检查确认:如图3

(16) WordPress Theme Migration: Does Emoji Process Code Need to Keep?

图2 Site Wide Header

(17) WordPress Tab NoIndex Optimization: Practical Sharing from Theme Migration to Code Refactoring

最近,我在检查我的 WordPress 网站时,发现浏览器开发者工具的控制台里出现了几个令人不安的红色错误信息:

(18) WordPress Console Error Troubleshooting Transcript: From jQuery conflict to Baidu statistical warning

再次无效后,我决定使用Auto Insert,Location选择"Frontend Only",并在代码中确定插入位置(图5)。

(19) From AD INSERTER to WPCode: CTA configuration migration and priority implementation

我重新审视了这篇文章的内容,发现文章中直接包含了 WPCode 的简码调用:wpcode。如图4

(20) Remember a full record of a wordpress 500 fatal error checking caused by wpcode shortcode

图6:Chrome无痕模式下,Logo和Favicon均显示正常

(21) Remember a WordPress 2025 Theme Logo and Favicon’s Tossing Journey

新的实现方式:基于WPCode Location的优化方案

(22) From AD Inserter to WPCode: CTA configuration migration and optimization practices

初始配置(图1)

(23) WPCode code snippet insertion order problem: the gap between theory and practice

图 2:区块右侧面板的“额外 CSS”输入框。

(24) Optimize the list spacing of popular articles in WordPress to improve your reading experience

页面底部出现横向滚动条。

(25) A horizontal scroll bar appears on the WordPress page? A complete check record from CSS to a block editor

图 3:最终效果——浏览器标签栏、WordPress 编辑器及网站 Logo 显示正常,方块感基本消失

(26) The logo generated by AI still has white edges? Complete WordPress Favicon Block Feelings with ChatGPT Plus

图 4:控制台出现 availableWidth=0

(27) WordPress archive page AdSense error AvailableWidth=0: the whole process of checking from the horizontal scroll bar to the Gutenberg block structure

From Classic to Block (final chapter): The theme migration is over, I decided to stop tossing

(28) From Classic to Block (final chapter): The theme migration is over, I decided to stop tossing

Recently, when adjusting the sidebar of the blog archive page, I encountered a seemingly simple but troubleshooting problem for a long time.

On the surface, it is a mobile-side horizontal scroll bar problem.

But after continuing the investigation, I found that Google AdSense’s error was also involved:

Plaintext
Uncaught TagError: adsbygoogle.push() error:
No slot size for availableWidth=0

More interesting is:

When I solve one of the problems, the other problem reappears.

The root cause of the problem is neither CSS nor AdSense, but the Gutenberg block structure.


problem background

An AdSense ad slot is placed in the sidebar on the right side of the archive page.

The original ad code is as follows:

HTML
<ins class="adsbygoogle"
     style="display:block; width:450px; max-width:100%;"
     data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
     data-ad-slot="4220340824"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>

<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

Why set up:

CSS
width:450px;

It’s because AdSense has always reported an error before:

Plaintext
No slot size for availableWidth=0

After adding a fixed width, the error disappears.

But a new problem arises.


Phase 1: A horizontal scroll bar appears on the mobile terminal

Figure 1: A horizontal scroll bar appears on the mobile terminal
Figure 1: A horizontal scroll bar appears on the mobile terminal

When testing on the mobile terminal, it is found that the right side of the page can be scrolled horizontally.

Initially doubt:

  • Category drop-down box
  • tag cloud
  • Calendar
  • Custom CSS

It is even suspected that it is a Twenty Twenty-Five theme.

To locate the problem, I do it in the browser console:

JavaScript
const vw = document.documentElement.clientWidth;

[...document.querySelectorAll('*')]
  .filter(el => el.getBoundingClientRect().right > vw)
  .map(el => ({
    tag: el.tagName,
    class: el.className,
    width: Math.round(el.getBoundingClientRect().width)
  }))

It turns out that the width of a large number of elements has become:

Plaintext
450px

Include:

  • Advertising
  • tag cloud
  • Calendar
  • sidebar content

After continuing to investigate, it is found that the culprit is in the advertisement:

CSS
width:450px;

Stage 2: Solve the horizontal scroll bar

So change the ad code to:

Figure 2: Ad code modification
Figure 2: Ad code modification
HTML
<ins class="adsbygoogle"
     style="display:block; width:100%; max-width:100%; box-sizing:border-box;"
     data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
     data-ad-slot="4220340824"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>

After modification:

Figure 3: Horizontal scroll bar disappears
Figure 3: Horizontal scroll bar disappears

The mobile page is back to normal.

The horizontal scroll bar completely disappeared.


Stage 3: New problems arise

However, after the horizontal scroll bar disappeared.

The console reappeared the previous error:

Figure 4: Console appears AvailableWidth=0
Figure 4: Console appears AvailableWidth=0
Plaintext
Uncaught TagError: adsbygoogle.push() error:
No slot size for availableWidth=0

That is:

Plaintext
width:450px

AdSense 正常

移动端异常

width:100%

移动端正常

AdSense 报错

The two problems can’t seem to be resolved at the same time.


Stage 4: Begin to doubt the Gutenberg block structure

At this point, start checking the archive page template structure.

The original sidebar structure is as follows:

Figure 5: Original Structure (Stack)
Figure 5: Original Structure (Stack)
Plaintext
栏目
└── 栏目
    └── 堆叠(Stack)
        ├── 搜索
        ├── 分类列表
        ├── 广告(WPCode)
        ├── 标签云
        └── 日历

I have tried many options during this period:

  • Modify Column width
  • Adjust the sidebar scale
  • Add Min-width to ads
  • increase min-height
  • Package ads with GROUP
  • Use custom HTML blocks
  • Delay execution adsbygoogle.push()

None of the problems were completely solved.


Final solution

Then try to:

Plaintext
堆叠(Stack)

Replace directly with:

Plaintext
组(Group)

The modified structure is as follows:

Figure 6: Modified Structure (Group)
Figure 6: Modified Structure (Group)
Plaintext
栏目
└── 栏目
    └── 组(Group)
        ├── 搜索
        ├── 分类列表
        ├── 广告(WPCode)
        ├── 标签云
        └── 日历

Refresh the page after saving.

The problem disappears directly.


Final outcome

Figure 7: Final effect
Figure 7: Final effect

Eventually satisfy:

1. AdSense no longer reports an error

The console is back to normal:

Plaintext
No slot size for availableWidth=0

no longer appear.

2. The ad is displayed normally

No fixed width required:

CSS
width:100%;
max-width:100%;

can load normally.

3. There is no horizontal scroll bar on the mobile terminal

The page is back to normal.

4. Sidebar layout restores nature

The right side of the calendar will be close to the edge of the screen.

After modification:

  • Calendar display is normal
  • Label cloud display is normal
  • The entire sidebar spacing is back to normal

Cause analysis

Although the official WordPress document does not explicitly state the difference between the two.

But from the actual performance:

Plaintext
Stack(堆叠)

During the layout calculation phase, the width of the internal elements may not be finalized.

And AdSense’s:

Plaintext
(adsbygoogle = window.adsbygoogle || []).push({});

execute earlier.

So it appears:

Plaintext
广告初始化

检测可用宽度

availableWidth = 0

抛出异常

And:

Plaintext
Group(组)

This problem will not occur.


Summary of this investigation

The entire investigation process actually goes through:

Plaintext
AdSense 报错

添加 width:450px

报错消失

移动端出现横向滚动条

删除 width:450px

横向滚动条消失

AdSense 再次报错

排查 Gutenberg 结构

Stack → Group

问题彻底解决

The biggest gain this time is not to fix a bug, but to verify an experience again:

When there is an abnormality in the page layout, prioritize specific elements and block structures, and do not doubt CSS or write a lot of patch code from the beginning.

Many times, the real problem may just be a block type wrong choice.

The logo generated by AI still has white edges? Complete WordPress Favicon Block Feelings with ChatGPT Plus From Classic to Block (final chapter): The theme migration is over, I decided to stop tossing

Technical Blog Growth & Monetization Consulting

I have been running my personal technology blog for more than 10 years and have published over 1,000 original articles covering WordPress optimization, multilingual websites, Google SEO, content strategy, and website monetization. All insights shared on this site come from real-world operation and long-term experimentation. If you are building a blog, developer website, SaaS project, or content-driven platform, I would be happy to share practical experience and optimization suggestions.

Ideal For:
✅ Technical bloggers
✅ Independent developers
✅ SaaS website owners
✅ Content creators seeking organic traffic growth
✅ Website owners interested in monetization opportunities

What I Offer:
✅ WordPress Performance Optimization
✅ SEO Consulting
✅ Multilingual Website Setup
✅ Ad Revenue Optimization
✅ Blog Growth & Monetization Consulting

If you would like to discuss your website, traffic growth strategy, or monetization opportunities, please contact me and mention: Blog Growth Consultation.

Contact Me:
Telegram: @shuijingwan
WeChat: 13980074657
Email: shuijingwanwq@gmail.com

评论

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.