DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

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.


  1. thanks

    ps you didnt close your php tag 🙂

  2. Hi,
    How is the code look like, if I’d like to have 2 or more certain categories not indexed by Google?

Leave a Comment

Your email address will not be published. Required fields are marked *