Google Mature Adsense Policy workaround for a Wordpress Blog

I am also a Security Editor at a very popular student portal AskStudent. Like most other portals, our operations are supported by Advertising and we use Google Adsense to take care of advertising on AskStudent. At AskStudent, we cover a lot of topics such as Security, Health, Career, Jobs, Coding, Money matters, Shopping etc. We also cover Sexual Health and Love and Relationships at AskStudent.

Last week, out of the blue, our Senior Editor gets an email from the Google Adsense Team

Hello,

While reviewing your account, we noticed that you are currently displaying Google ads in a manner that is not compliant with our policies. For instance, we found violations of AdSense policies on pages such as http://www.askstudent.com/2006/12/02/maturecontentpostataskstudent/?preview=true.

As stated in our program policies, AdSense publishers are not permitted to place Google ads on pages with adult or mature content.

Please make any necessary changes to your web pages in the next 3 business days. We also suggest that you take the time to review our program policies (https://www.google.com/adsense/policies) to ensure that all of your other pages are in compliance.

Once you update your site, we will automatically detect the changes and ad serving will not be affected. If you choose not to make the changes to your account within the next three days, your account will remain active but you will no longer be able to display ads on the site. Please note, however, that we may disable your account if further violations are found in the future.

Thank you for your cooperation.

Sincerely,

The Google AdSense Team

Now, this was a problem. We did not know what Google treated as mature content. However, with respect to the post in question, it was justified. So the first step we did was remove all ads serving on AskStudent while we figured out a solution to this problem. At AskStudent, we use Adsense Deluxe plugin. If you don’t use this plugin and manually serve ads or hard coded the ads, then I would highly recommend using this plugin.

Now, There are two solutions to solving this problem of how to avoid serving ads on a mature content post but keep serving ads on the rest of the blog

Solution # 1: After disabling ads generation through Adsense Deluxe, you can manually copy and paste adsense code onto individual posts. However for a portal like AskStudent with hundreds of articles, this is almost a highly time consuming if not an impossible task.

Solution # 2: Perfect Solution: Code it up

Login to your Wordpress blog. Now, go to Presentation and click on theme editor which should show up with the option to edit your current theme. Now, on the right hand side, scroll down until you see under the theme files, a “Single post” or “single.php” file.

Step # 1: Copy the entire content of your single.php file.

Step # 2: Launch notepad and paste the content of your single.php file. Rename this single1.php.

Step # 3: Now, launch notepad once again and paste the contents of your single.php file again. Only this time, if you manually hardcoded the adsense code into your template files or using Adsense deluxe, remove the lines of code or the line of code with the ad generation part. Save this file as single2.php

Step # 4: Now, copy these two files, single1.php and single2.php into your current theme folder of your wordpress blog. The path should be ftp://<your website>/wp-content/themes/<your current theme>

Step # 5: Now, in your theme editor in your wordpress blog, select single.php. Remove everthing and copy paste the following code in there

$post = $wp_query->post;
if (in_category(’29′) ){
include(TEMPLATEPATH . ‘/single2.php’);
} else {
include(TEMPLATEPATH . ‘/single1.php’);
}
?>
 

At AskStudent, we felt most of our Mature content was under the category of Love and Relationships which was category 29. So, what we are doing here is that when Wordpress is quering looking for a single post content, if it sees that this post is from category 29 then it is going to use single2.php file which if you remember was stripped out of the adsense code. All other posts in the remaining categories will use the single1.php file which is a copy of the originial single.php file.

Step # 6: Save and exit and you should be all set

Leave a Comment