How to: disable search engine indexing on a single post

January 9, 2009 at 8:42 am

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!

Tags: