Post Pic

How to: disable search engine indexing on a single post

Most of the time, you want your posts to be indexed by search engines as such as Google as soon as possible. But if for some reason, you don’t want a particular post to be indexed by search engines, just read on!

To achieve, first get the ID of the post you'd like to be not indexed by search engines. In this exemple, I assume your post id is 17.
Open your header.php file and paste the following code between the <head> and </head> tags:

 <?php if ($post->ID == 17) {
    echo '<meta name="robots" content="noindex">';
}

That's all. Pretty useful if you don't want some infos to be accessible from search engines!
Note that it is possible to do something better by using custom fields. If you're interested about this second method, just leave a comment and I'll write a recipe!

19 Responses

Jan 09 2009 11:55

custom fields,, would love to know about… you have my mail address right i will like 2 know abt it

Jan 09 2009 14:20

May I know why we should make a non index in single post? Is that good for SEO? thanks for your answering

Jan 09 2009 16:33

You can do this with the WordPress Plugin wpSEO, for every post or page, no code editing needed.

Jan 09 2009 17:38

Oh sorry, I’m wrong on reading the title. I think I’m not concentrate to translate. I think before, it’s not using index on single page hehe, sorry. Yes, if it’s disable, we can do that with wp seo plugin. Every post and page will get index.

Jan 09 2009 19:25

Thank you – this is just the tip I’m looking for! I was looking for a way to set the noindex tag on a particular page on my WordPress blog, without using a plugin. I was using the RobotsMeta plug in but it is not working in WP 2.6+ for me.

I have a page that I don’t want people to go to directly, I want them to go through another page first. And I have other pages that aren’t useful to show up in the search results.

@Sergej – thanks also for the wpSEO plugin reference, I’ll keep that in mind for the future in case I want do to this with a plugin again at some time.

Jan 09 2009 20:53

Actually I went back and tried this, and found that the RobotsMeta plug in was working – but my theme had the robots, content=”follow, all” hard coded in the header.

So if you are using the technique in this post check to make sure your theme (Revolution, in my case) does not already have a <meta name=”robots” tag in it, and if it does replace it.

Jan 11 2009 04:27

I’d be very much interested about having something much simpler via Custom Fields :)
Really helps a lot for Sponsored Posts and other posts that I only want my readers to see.

Jan 11 2009 17:22

Whenever we build a client site with a lead generation offer, I usually build a hard-coded page to deliver the freebie so I can control the indexing. This is a great tip, but I’d also like to know how to do this via custom fields. Love your blog by the way!

Jan 17 2009 10:25

Just a pretty quick question:
ID == 17)
is for specific post IDs that we have to add, right?
how about changing that statement to a specific category? I don’t really get how to do it.

Jul 05 2009 20:56

isn’t it posible guys to disable your search engine specially your google and yahoo? thanks alot,

Sep 15 2009 22:04

Even though you can use plugins to do this task, it’s always interesting to learn new tricks. I usually prefer hand coding, so this little trick is very helpful. Thanks!

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required