Hide Adsense on a per-post basis on a WordPress website

When building niche websites, we sometimes want custom functionality when a certain condition is met.

If you’re creating a niche site that uses affiliate links and display ads, you don’t want visitors clicking ads instead of affiliate links.

In this video, we’ll look at a simple trick to disable Google Adsense on a per-post basis, and this is made easy by using two well-known and well-maintained plugins.

Watch the video

What plugins do I need?

To get started with building this functionality, you’re going to need the following:

Code Snippet

Remember to find and replace [your-adsense-id] with your own Google Adsense ID.

Leave a comment