How To Exclude Categories From Adsense Auto Ads



There are plenty of plugins available that lets you install adsense auto ads to your site. I have adsense on my site too.

Initially, my method is to inject the ads code to the head of my site. It works. However, since now I have WooCommerce plugins to sell, I want to disable ads on post categories that related to WooCommerce (Because I have ads for my products there).

Also, I have a custom post type (which is the sales page of my products) that I want to exclude from displaying ads too.

I searched for a plugin that does just that but no avail (After 10 minutes searching on Google. I’m impatient, I know). So, I decided to make one that does the job for me.

Meet the WordPress plugins that let you enter ads with options to exclude form categories/custom post types

So, here is what I created:

How To Exclude Categories From Adsense Auto Ads 1

You can download the plugin here:

As you can see, the interface is quite busy. However, there are three main sections:

  1. A textarea where you can enter your auto ads code from Google Adsense
  2. Next is the list of categories on your site. If you want to exclude a certain category, simply select it
  3. Finally, here are the list of custom post types on your site. I have 4 custom post types on my site. You may have more or less. Check the types that you don’t want to show ads

Now you may ask, how can you exclude ads from WooCommerce product pages? Well, if you have WooCommerce installed, in the list of custom post types, you’ll see one option named “product”. Check that box if you want to exclude WooCommerce from showing ads.

Here is my configuration:

How To Exclude Categories From Adsense Auto Ads 2

As you can see, I excluded all categories related to WooCommerce and one custom post type called bc_app. This is the pages where I sell my plugins.


Hopefully the plugin is useful to you. If you have any suggestions or feature requests, simply comment below.

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

Leave a Reply

Your email address will not be published. Required fields are marked *