• I upgraded to WordPress 4.1 a few days ago. The next day I was trying to add a new AdSense ad to one of my pages and it wouldn’t display at all even though previous ads were showing fine. I was pulling my hair out but yesterday I finally figured out what the problem was. So if you’re experiencing it as well, here’s how I fixed it.

    When you grab the code from AdSense, it looks like this:

    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Ad Unit Name -->
    <ins class="adsbygoogle"
         style="display:inline-block;width:300px;height:250px"
         data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
         data-ad-slot="xxxxxxxxxx"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>

    To get it to display, I removed the line breaks in the “ins” tag so the code looks like this now:

    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Ad Unit Name -->
    <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" data-ad-slot="xxxxxxxxxx"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>

    This change is only required when the ad is within the body of a post or page. It works fine as is in my widgets and in my functions.php file.

    [Unrelated question: Is there a way to search JUST the forums and not all of www.ads-software.com? I wanted to see if I could find any other threads about this issue but mostly got a list of plugin pages.]

Viewing 6 replies - 1 through 6 (of 6 total)
  • In Google, you can prefix the search query with the “site:” + the path which you want to use to filter results, for example:

    site:https://www.ads-software.com/support google ads

    techforluddites Thanks a lot for sharing this code with me. I was in the exact same boat as yourself and this solved my issue completely. Cheers! ??

    Thread Starter techforluddites

    (@techforluddites)

    @lorro: Thanks for that tip!

    @jay kay: Glad it helped!

    I am facing the same issue in both content and sidebar but ads not showing. Not only google ads but others like chitika also. Its’working fine in other theme.

    After way too much time spent on this problem, I was SO PLEASED to find your posting!! It worked like a charm for me..thank you so much for taking the time to share this fix!

    Thread Starter techforluddites

    (@techforluddites)

    @stahmi, I’m glad it helped! I can totally relate to your spending way too much feeling… I was starting to think I was losing my mind! ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘AdSense Fix after WordPress 4.1 Upgrade’ is closed to new replies.