How To Disable Ads On Posts: Google AdSense Plugin For WordPress

Despite mixed reviews, I’m a fan of the official Google AdSense Plugin for WordPress because it’s easy to set up, works beautifully on mobile devices, and seems to generate more revenue than ad units I place myself. Best of all, it’s a huge timesaver—and I’ve spent a lot of time tweaking ad layouts in the past. In this article, I’ll show you how to enable the AdSense Plugin meta box so you can disable ads on single posts.

WordPress AdSense Plugin Meta BoxI recently launched a new section of this website with posts that I don’t want to have ads, but when I went to disable the ads on those specific posts, I noticed something strange: Even though there was a AdSense Plugin meta box with a “Disable ads on this page” checkbox in the WordPress Pages editor, there was no AdSense Plugin meta box in the Posts editor.

I Googled the problem and didn’t find anything but frustrated users, but I figured that if you could disable AdSense for individual pages, the functionality must already be built in. The solution is as simple as changing a single line of code. We’ll enable the AdSense plugin meta box for pages and posts, so you can disable ads on single posts in WordPress. 

How To Disable Ads On Single WordPress Posts With The Google AdSense Plugin

  1. Go to Plugins -> Editor in the WordPress dashboard.
  2. Select Google AdSense in the Select plugin to edit: menu at the top, and click Select.
  3. From the list of files on the right, click to open the file called google-publisher/Admin.php.
  4. Change 'page' to array('page', 'post') in this section of code, so this:becomes this:Edit Google AdSense Plugin WordPress
  5. Click Update File to save your edits.
  6. Return to the WordPress post editor and check the box next to Disable ads on this page.Check Disable Ads On This Page
  7. Update or Publish the post with no ads.

That’s right: We fixed the problem by changing a single line of code!

Wrapping It Up

By this point, you’ve successfully added the AdSense Plugin meta box to the WordPress editor and you can disable ads on the posts you choose. Writing good articles is all about user experience, and users don’t like seeing ads—so when I need to turn them off, it’s a win-win for me and for my readers.

Thanks for reading, and remember to Payette Forward,
David P.

About Author

I'm a former Apple employee and the founder of Payette Forward, and I'm here to help you with your iPhone.

9
Leave a Reply

avatar
4 Comment threads
5 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
Anonymousrhea sinhaDavid PayetteElisabeth van der Zalm Recent comment authors
  Subscribe  
Notify of
Anonymous
Guest
Anonymous

i hope it does cause i’m about to try it on my blog post

Anonymous
Guest
Anonymous

after reading some other comments I wanted to add that I was also trying to add facebook back on my phone after issues with it

Anonymous
Guest
Anonymous

This doesn’t work

rhea sinha
Guest

This worked perfectly. Thanks a lot for the simple precise instructions.

Elisabeth van der Zalm
Guest
Elisabeth van der Zalm

Thanks very much David, this was really helpful for me!