How to Completely remove AdSense Code from Single Page?

While it’s easy to get rid of the AdSense code from a page, I have no idea how to stop Auto Ads (formerly Page Level Ads) from automatically putting an ad on a particular page. For example, I don’t want any ads on my homepage. And I have removed all codes from there. But still, AutoAds automatically places an ad unit at the footer. :unamused:

Any idea how to get rid of it? (without getting rid of Auto Ads)

try this, hope it help :slight_smile:

There are two ways:

  1. Let’s take an example of my website – I am using DOT NET and there are some master pages and all pages are rendering from them. If such kind of this is valid or allow in Wordpress you may try it.
  2. You can write JavaScript or JQuery and put the ad code within it. Get the URL and check if it is homepage then ad code should not be loaded.

Thanks, but that did not help! Auto Ads are different from normal ad units. The site talks (confusingly) about normal ad units. But, thanks for the reply!

I don’t think the above is possible.

Could give the above method a shot. But the thing is, we are required to place Auto Ads code at the head section. Not sure how feasible your suggestion is as I have no idea about JavaScripts.
PS: I know we were supposed to connect today. But got held up with other things. :confused: We shall connect soon! :upside_down_face:

1 Like

You can try this

if( window.location.href!='https://yourwebsite.com')
{
 //put ad code here
}

Note: I never tried it anywhere, never suggested to anyone till now.

1 Like

Will try this and report back in the morning. Already tucked in bed. Long day ahead tomorrow. :sleeping:
Thanks a lot, appreciate it.

1 Like

Good night

Night night! :sleeping:

Load AdSense Ad everywhere except for page permalink about

function conditional_adsense() {
if ( ! is_page( 'about' ) ) echo '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>';}
add_action('wp_head', 'conditional_adsense');

How to apply?

  • First remove adsbygoogle.js from all ad units
  • Paste above snippet using Code Snippets in order to load AdSense required js adsbygoogle.js conditionally.

I hope this helps.

2 Likes

Interesting. Will give this a shot in the morning!

1 Like

I got rid of AutoAds altogether. Manual placements are working like magic. AutoAds does more harm than good.

Sorry, your question is wrong. I nowhere mentioned term “auto ads”. Please read my last response again.

I already answered above.

@GulshanKumar my problem was because of AutoAds bro. So I just simply got rid of that. :grin:

1 Like

@vish Good to know.

Fortunately, Auto Ad or Manual ad, both uses same script i.e, adsbygoogle.js. So, my answer is common for both.

1 Like

Super bro :grin::+1:

1 Like

Closing this thread.

Thanks all for participating.

1 Like

This topic was automatically closed after 1 minute. New replies are no longer allowed.