How to Exclude Adsense On Specific WordPress Blog Posts Using Slug

Besides using the post ID which I had written before, here is another method to exclude Adsense (AdSe) on a particular blog post of WordPress. It makes use of the slug.

A WordPress slug is a few words that describe a post or a page. It is actually an URL friendly version of the post title. It comes with a hyphen between each word of the title.

STEP ONE

How To Look For WordPress Post Slug

1. Click on All Posts .

2. Select the particular blog post which you want to exclude AdSe.

3. Click on Quick Edit.

4. You should be able to see both the blog Title and Slug.

5. Just as an example, these are your three slugs from the the three blog posts that you do not want to have AdSe:

how-to-buy-iphone
tips-on-how-to-buy-stocks
useful-ideas-for-single-mothers


STEP TWO

1. Go to either the header.php and/or single post.php and look for your AdSe code.

2. Now add this code:

<?php
if (!is_single(array('how-to-buy-iphone','tips-on-how-to-buy-stocks','useful-ideas-for-single-mothers')))
{
?>
YOUR ADSENSE CODE
<?php
}
?>

3. Click Update File button.

That's all.  

By:Kher Cheng Guan

Blogspot And WordPress Help Tips, Updated at: 11:42 PM