How to Disable Adsense on a particular page?

Hello Friends,

I am getting a “Page Level Violation” in Google Adsense for the page on my client blog.
The exact location is the “Page no. 2 of Blog Post Listing”.

URL: https:// www. domainname .com/blog/page/2


Can anyone help me how to disable Loading Adsense in this particular page?

There is no official conditional tag to prevent thing on sub page. It would require more customization which I don’t know.

// Display AdSense only on Blog post
function conditional_adsense() {
if ( is_single() ) echo '<script async src="//"></script>';}
add_action('wp_head', 'conditional_adsense');

Brother Please Explain How It Works?

The above function echo script in the head just for “single blog post” and no other page.

This is how you can load adsbygoogle.js everywhere except on /page/2/

if (document.location.href.indexOf('/page/2/') === -1) {
    var imported = document.createElement('script');
    imported.src = '';
1 Like

If it is a WordPress blog, you can use Ad inserter plugin to insert and block ads on specific pages/posts with their ID.

1 Like

Hi brother, the was on Sidebar and Footer. Also, the affected is not a blog post. It’s a paginated page no.2…

1 Like