• 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
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

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • PHP Snippet to Hide AdSense Unit on WordPress 404 Page

    Here is Easy PHP Snippet to Hide AdSense Unit on WordPress 404 Page to Avoid Policy Violation and Decrease False Impression, False Low CTR.

  • Hide AdSense Unit on Mobile Devices (Responsive Design)

    Here is How to Hide AdSense Unit on Mobile Devices on Websites With Responsive Design in Google Recommended Way to Remain Compliant With AdSense Policy

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 (24.3K 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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

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

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