Set-up
I have the following standard Adsense script inserted in my header.php
file,
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js">
</script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-********",
enable_page_level_ads: true
});
</script>
This allows me to display ads on all pages instantly without too much hassle.
Problem
I'd like to prevent display of all adsense ads on specific pages of my website.
I'm looking for some 'if' function to stop the display. Anyone knows of such a function?
$dont_display = array(1,15,2106);
, only display your code, if current id is not one of thoseif ( ! in_array($post_id, $dont_display)) { /* your html code here */}