Excluding Adsense Ads from Certain Pages

I have added Adsense ads to my site using the hooks, but I can’t figure out how to exclude the ads from some of the pages. Can anyone help? Thanks

Hi alyce, To exclude specific pages you can put a is_page() condition.

You can pass the page title or slug or id as the parameter in the following manner.

if ( !is_page('dont-show-adsense') ) {  
    //Adesense code  

Thanks Joshua, But this did not work for me. Here is what I did:

if ( !is_page('About Me', 'Contact', 'Privacy Policy', 'Disclosure/Disclaimer') ) {


I put this right on the hook option page under 'before post content section.' Thanks for your help. Alyce

Hi alyce,

If you are trying to check for multiple pages then you need to specify them in an array. Try this.

if ( !is_page(array('About Me', 'Contact', 'Privacy Policy', 'Disclosure/Disclaimer'))) {  

And to be on the safer side instead of the page titles, try putting the slug names of the pages.