• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How To Hide AdSense Units On Selected WordPress Post

By Abhishek Ghosh July 3, 2017 2:11 pm Updated on July 3, 2017

How To Hide AdSense Units On Selected WordPress Post

Advertisement

Usually we need to hide AdSense unit for policy compliance or for control of keywords to AdWord users. Here is how to hide AdSense units on selected WordPress post. There is CSS, PHP, Javascript or simply ready to use WordPress Plugin to do it. Previously we actually talked about some solutions for 404 pages like pages. We will link those old mentioned ways under proper sub-headers in this guide. We are taking it granted that user is using responsive Ad units.

How To Hide AdSense Units On Selected WordPress Post

 

How To Hide AdSense Units On Selected WordPress Post : Using WordPress Plugin

 

Once we touted free Ad Injection as best AdSense plugin. If you are injecting AdSense units via Ad Injection’s main page or widgets, you can easily block AdSense to get injected by using option provided by Ad Injection. There is way to add Comma post or page IDs like 267, 838, 1243 and select option as “Never Show in”. 5 minutes matter. You can also set a custom tag or category and restrict. This method works for traditional and responsive Ads.

 

How To Hide AdSense Units On Selected WordPress Post : Using CSS

 

Most useful and highly effective in difficult situations. This works only for responsive Ads. Normally standard WordPress themes like StudioPress Genesis has way to inject scripts on header, body etc on particular post from WordPress post editing page. You’ll get documentation for “Hiding an ad unit” by Google AdSense :

Advertisement

---

Vim
1
https://support.google.com/adsense/answer/6307124

You need to have similar setup for showing Ads on your website. If your targeted Ad unit’s class is adslot_1 then if you inject this kind of CSS on particular post from WordPress post editing page, Ad unit will get collapsed :

Vim
1
2
3
4
<style type="text/css">
@media (max-width: 1500px) { .adslot_1 { display: none !important; } }
@media (min-width:500px) { .adslot_1 { display: none !important; } }
</style>

It is not illegal as long you are doing for not violating policy. If you have sexy booby girl’s photographs on a post, you can use this. AdSense has prohibited contents. If your whole site has such contents of course it is not eligible for using AdSense, but odd 1-2 conflicting situation can arise :

Vim
1
https://support.google.com/adsense/answer/1348688?hl=en

 

How To Hide AdSense Units On Selected WordPress Post : Using PHP

 

We talked about hiding AdSense units on WordPress 404 pages and different AdSense units for mobile and desktop. They are based on similar logic and both linked articles are important to read if you are not used with such. We will need to programmatically determine when in this specific post ID 2 the logic is passed :

Vim
1
2
3
4
if (is_single("15"))
{
//Do in intended post whose ID is 15
}

Exactly like 404 page’s logic, say NO to post whose ID is 15 :

Vim
1
2
3
<?php if ( ! is_single("15") ) : ?>
// Adsense code here
<?php endif; ?>

Here is function reference :

Vim
1
https://developer.wordpress.org/reference/functions/is_single/

 

How To Hide AdSense Units On Selected WordPress Post : Using Javascript

 

You should email to AdSense account manager.

Tagged With Google

This Article Has Been Shared 136 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How To Hide AdSense Units On Selected WordPress Post

  • AdSense Asynchronous Ads with Responsive Design

    AdSense Asynchronous Ads with Responsive design is a quite difficult to manage or implement. Here are some ideas which might help you for HTML5 website.

  • 100 Tips for Building and Maintaining a Successful Blog

    100 Tips for Building and Maintaining a Successful Blog is the 2500th article published on this website.Free Infographic is also included so that you print it.

  • Responsive Web Design, Grid System and Mobile Website

    Responsive Web Design, Grid System and Mobile Website are used for making a website easily viewable on any mobile devices including Tablets. Here is a guide.

  • Planning and Using Responsive AdSense Ad Unit

    Planning and Using Responsive AdSense Ad Unit is crucial step because we are going to target the same place with three or more AdSense Ad Unit. Here is how.

  • Schema.org for WordPress : Advanced Tips for Genesis 2.0

    Schema.org for WordPress is nicely integrated by Genesis 2.0 but in terms of semantic complexity, it requires some advanced hand made tweaking.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (22.1K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Ways To Make Sure Your Online Course Outshine Others July 3, 2022
  • Will Smart Factories Become the New Assembly Line? July 2, 2022
  • The Cost of Doing Business as a Handyman July 1, 2022
  • Samsung Galaxy S22 Ultra: Long Term Review June 30, 2022
  • How to Make the Most of Your S Pen (S22 Ultra) June 29, 2022

About This Article

Cite this article as: Abhishek Ghosh, "How To Hide AdSense Units On Selected WordPress Post," in The Customize Windows, July 3, 2017, July 3, 2022, https://thecustomizewindows.com/2017/07/hide-adsense-units-selected-wordpress-post/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2022 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy