chevron_right
chevron_right
How to disable ads in wp-admin
How-To/Instructional

How to disable ads in wp-admin

Last Updated over a month ago
Article Navigation
Introduction
Instructions
Contact Information for Further Assistance

Introduction

Publishers using EzoicAds typically choose to disable ads in their WordPress admin, to prevent interference with their workflow. Ezoic does this automatically for publishers that are cloud integrated, however publishers that are JavaScript integrated will have to manually add an extra piece of code to their domain(s).

Instructions

  1. Install the WPCode plugin.

2. Go to 'Code Snippets'.

3. Click 'Add New'.

4. Click 'Add Your Custom Code (New Snippet)'.

5. Click 'PHP Snippet'.

6. Add the following code to disable ads for all logged in users:

function disable_ads_meta_tag_for_logged_in_users() {

    // Only add the meta tag if the user is logged in

    if (is_user_logged_in()) {

        echo '<meta name="disable_ads" content="1">' . "\n";

    }

}

add_action('wp_head', 'disable_ads_meta_tag_for_logged_in_users', 1);

Note: If you want to only disable ads for admins and not those with the role 'subscriber' then use this alternate code instead:

function disable_ads_meta_tag_for_contributors_and_above() {

    // Only add the meta tag if the user is logged in AND has contributor level or above

    if (is_user_logged_in() && current_user_can('edit_posts')) {

        echo '<meta name="disable_ads" content="1">' . "\n";

    }

}

add_action('wp_head', 'disable_ads_meta_tag_for_contributors_and_above', 1);

7. Click 'Update'. 

8. The final step is to create a rule to disable ads when Ezoic detects the meta tag you've just added to your wp-admin pages. You can do this via https://pubdash.ezoic.com/ezoicads/adrestrictions. Under 'Page Rules', click 'New Restriction'.

9. Select 'Meta Tag' from the drop-down menu, then enter 'disable ads' next to 'Meta Tag Name' and '1' next to 'Content'. Finally, click 'Create Rule'.

That's it - you're done!

Contact Information for Further Assistance

If you need further assistance with disabling ads inside your wp-admin, please log in via https://support.ezoic.com/ to make use of our dedicated resources for support. We're here to help!

× Enlarged Image

Loading ...