How to Exclude Adsense from Specific Posts Without Editing WordPress Code?

If you are running a WordPress blog monetized with Google Adsense, you have probably looked for a way to hide Adsense ads from certain posts. You will be surprised how easily you can achieve this.

Google Adsense is a great program for publishers to monetize their blogs. It is a great way of funding your blog’s hosting costs and make atleast beer money from it. More serious folks make a killing with it and even try to replace their full time job.

There are a few things about Google Adsense that you need to be aware of to maximize its potential. You don’t want to turn off your regular readers by slapping ads everywhere. You want to target your ads to your search engine traffic.

You can easily address this like I have here using an excellent plugin called Who Sees Ad.

Who Sees Ad WordPress Plugin

This great plugin by Ozh is an advanced Adsense ad management plugin. It gives you great control over who can see your ads.

Who Sees Ads lets you create individual contexts for different ad units. For eg. I have a context which shows the main in-post Adsense ads only on posts older than 7 days. Usually most of my regular readers have already read the new posts and ads are shown primarily to Search Engine visitors.

Here is a screenshot of a setup I have


You can read all about this plugin here.

Why Exclude Ads from Certain Posts?

Let’s think about why you would want to do this first. Let’s say you had a post that was really popular with the search engines. But, the topic is in such an area that it is attracting really low CPC (cost per click) ads and very few clicks. You could improve your Click through ratio (CTR) by not showing ads on such posts. This would decrease ad  impresssions on posts that hardly attract any clicks.

How do you Exclude Ads from Certain Posts?

With the Who Sees Ads plugin, excluding ads from certain posts of your choice is very easy.

  1. Find the ID of your posts you want to exclude from showing ads
    • Go to the Edit posts section in WordPress admin
    • Hover over the post and look at the status bar
    • You will see the url as
    • Here the post id is 1297
  2. Now go to the Who Sees Ads context you have (See screenshot for example)
  3. To exclude a single post from showing an ad, you’d add a condition like
    is_single(‘<post_id>’) then don’t display
    For eg. to exclude post id 1297 ,I’d add is_single(‘1297’)


  4. To exclude a bunch of posts from showing this ad, you’d add a condition like
    is_single(array(1297,1299, 1343, 1223)) then don’t display
  5. You can also use other WordPress conditional tags available here.

It’s that easy! In fact, I have to thank @MattJabs of Debt Free Adventure for hitting me up this morning with this question.

Even though I was using this plugin for a long time I never explored this conditional tag that lets you add any PHP code you find useful to narrow down to certain conditions.

I hope you enjoyed this little tutorial. As Matt noted, there wasn’t a source available that explained how to do this and I hope you found it useful.

Who Sees Ads has been a part of my collection of Top WordPress Plugins for a while now.

Explore Tags: , , , , , ,

4 Responses to “How to Exclude Adsense from Specific Posts Without Editing WordPress Code?”

  1. Matt Jabs August 4, 2009 at 9:03 am #

    Thank you for the help K… I really appreciate it!

    I must say that this is an experimental thing for me to find out if it will help increase my $/click, but is great knowledge to have for excluding ads from certain posts. I have been blogging for over 3 years and did not know I could do this… it is a HUGE help.

    .-= Matt Jabs´s last blog ..Debt Reduction – Emergency Fund Savings – The Balanced 75/25 Method =-.

  2. Ferienwohnung Italien August 11, 2009 at 2:40 am #

    Wow…this is really helpful, i been wondering how to configure my adsense and eliminate some unwanted post on it and with the information you have provided i will be able to exclude them…i hope you can gave me some info i I have encountered some problem doing this, I will work on it tonight.
    .-= Ferienwohnung Italien´s last undefined ..If you register your site for free at =-.

  3. Maria August 25, 2009 at 3:31 am #

    i am just starting out with Google Adsense. i am hoping that i would earn a good deal of money on this program.


  1. Latest adsense news – How to Exclude Adsense from Specific Posts Without Editing … | test - August 6, 2009

    […] How to Exclude Adsense from Specific Posts Without Editing … […]