remove adsense from pages

  • tommyboy


    I have 3 ad-sense locations, one using an action hook, one using a side-bar widget and one using the theme’s option (and child theme).

    Through a plug-in I can disable the action hook and the side-bar widget ad locations on pages.

    Is there a way to disable the theme’s option ad-sense on pages?


    Prasanna SP


    Moved to Support. Please post in the correct section next time.



    Can you tell me how? I know I can disable them on the front page, but I want to disable them on my static pages only.

    Prasanna SP


    Add this to child theme functions.php

    function hide_adsense_if_page() {
    global $graphene_settings;
    if(is_page() ) {
    $graphene_settings['show_adsense'] = false;
    add_action( 'template_redirect', 'hide_adsense_if_page' );

    Untested and sent from mobile. Check syntax for errors before using the code.



    Awesome! that totally works. What if I need it disabled on Archive pages and tag archives?


    Prasanna SP





    if(is_page() || is_archive () )
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Do NOT follow this link or you will be banned from the site!