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

  • Get Audiophile-Grade Music on Your Smartphone March 25, 2023
  • Simple Windows Security and Privacy Checklist for 2023 March 24, 2023
  • 7 Best Artificial Intelligence (AI) Software March 24, 2023
  • ESP32 Arduino Water Tank Level Monitoring Using Laser ToF Sensor March 23, 2023
  • Exploring the Benefits and Advantages of Microsoft’s Operating System March 22, 2023

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, March 25, 2023, https://thecustomizewindows.com/2017/07/hide-adsense-units-selected-wordpress-post/.

Source:The Customize Windows, JiMA.in

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT