Disable search engine indexing on a particular category

January 25, 2009 · Print This Article

How to disable search engine indexing on a particular category?

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 18.

Open your header.php file and paste the following code between the <head> and </head> tags:

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

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

Your choice for site templates and wordpress themes


Got something to say?

You must be logged in to post a comment.