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

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

Here we can see, “How To Disable Ads On Posts: Google AdSense Plugin For WordPress”

Despite mixed ratings, I like the official Google AdSense Plugin for WordPress since it’s simple to install, looks great on mobile devices, and makes more cash than ad units I insert manually. Most importantly, it’s a significant time-saver—and I’ve spent a lot of time in the past refining ad layouts. I’ll show you how to enable the AdSense Plugin meta box so you may stop adverts on individual posts in this article.

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

I Googled the issue and found nothing but angry users, but I reasoned that since you could disable AdSense for individual pages, the functionality must be included already. Changing a single line of code is all it takes to solve the problem. We’ll enable the AdSense plugin meta box for pages and articles, allowing you to turn off adverts on individual posts in WordPress.

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

  1. In the WordPress dashboard, go to Plugins -> Editor.
  2. Click Select in the Select plugin to edit: the menu at the top to select Google AdSense.
  3. Click the file google-publisher/Admin.php from the right-hand list of files to access it.
  4. In this line of code, change ‘page’ to array(‘page’, ‘post’), as follows:
 public function addPageEditOptions() {
    add_meta_box('googlePublisherPluginMetaBox',
        __('AdSense Plugin', 'google-publisher-plugin'),
        array($this, 'showPageEditOptions'), 'page', 'side', 'low');
  }

becomes this:

 public function addPageEditOptions() {
    add_meta_box('googlePublisherPluginMetaBox',
        __('AdSense Plugin', 'google-publisher-plugin'),
        array($this, 'showPageEditOptions'), array('page', 'post'), 'side', 'low');
  }

5. To save your changes, click Update File.

6. Return to the WordPress post editor and select Disable advertisements on this page from the drop-down menu.

7. Update or publish the article without any advertisements.

That’s right: we only had to change one line of code to solve the problem!

Wrapping It Up

You’ve successfully added the AdSense Plugin meta box to the WordPress editor at this point, and you may now block advertisements on the posts you choose. It’s all about the user experience when it comes to writing good content, and people don’t like seeing advertising, so turning them off is a win-win for my readers and me.

Conclusion

I hope you found this guide useful. If you’ve got any questions or comments, don’t hesitate to use the shape below.

User Questions

1. How can I remove AdSense adverts from my WordPress site?

To disable advertisements in the frontend, go to Advanced Ads > Settings > General > Disable ads > Disable ads. Please keep in mind that if you manually place advertising using shortcodes, you will need to delete them. Otherwise, they may appear in your material.

2. How can I remove Google adverts from my website?

  1. Go to your Google Ads account and log in.
  2. Click Ads & extensions from the page menu on the left.
  3. Check the box next to the ad you want to get rid of.
  4. Click the Edit drop-down option at the top of the ad statistics table.
  5. Remove is the option.

3. Why are there advertisements on my WordPress site?

To help pay the bills, we occasionally display adverts on your free blog or site at WordPress.com. This ensures that free features remain free! Your visitors’ ad experiences are influenced by their geographic location, surfing habits, and other characteristics.

Also See:  opendns servers

4. How To Remove Adsense On Specific WordPress Post 

How To Remove Adsense On Specific WordPress Post Without Any Plugin? from WordPress

5. Google Adsense ads.txt : r/Wordpress – Reddit

Google Adsense ads.txt from WordPress