WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to block Adsense from appearing on post preview (2 posts)

  1. theobroma
    Member
    Posted 2 years ago #

    Hi All,

    I have Adsense ad units integrated into my blog's header and post template files.

    In the past, when I would create a post and use the preview function to see how it looked, Adsense ads did not appear at all in the preview.

    But with subsequent updates to WordPress (it seems), this is no longer the case. The ads do show up in the preview version of the post.

    Does anyone know how I can effectively prevent Adsense ads from showing up in post previews. Is there a snippet of code I can insert somewhere? Should my Robots.txt file be changed in some way?

    I recently created a Robots.txt file (below) but am now getting some "failed crawl requests" show up in my account.

    User-agent: Mediapartners-Google
    Disallow:

    User-agent: ia_archiver
    Disallow: /

    User-agent: *
    Disallow: /?p=*
    Disallow: /cgi-bin/
    Disallow: /wp-admin/
    Disallow: /wp-includes/
    Disallow: /wp-content/plugins/
    Disallow: /wp-content/cache/
    Disallow: /wp-content/themes/
    Disallow: /trackback/
    Disallow: /comments/
    Disallow: /category/*/*

    Any suggestions would be much appreciated.

  2. theobroma
    Member
    Posted 2 years ago #

    Solution found: I installed a browser add-on called AdBlock, which can be turned on and off as needed.

Topic Closed

This topic has been closed to new replies.

About this Topic