Kevin asked: “how to: disable search engine indexing on a particular category?”

January 25, 2009 at 8:54 am

Some days ago, I shown you how to disable search engine indexing on a single post. One of WpRecipes reader, Kevin Paquet, asked me how to do the same thing on a specific category. Here is the answer to Kevin question.

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

 <?php if ( is_category('8') || in_category('8') ) {
    echo '<meta name="robots" content="noindex">';

That’s all. With the above code, we made sure that no post from category with the ID 8 as well as category pages will be indexed by search engines crawlers.