WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like to publish drafts in my 'Uncategorized' category. This category is not linked anywhere on my site. It's great for allowing contributors to an article to read the draft before it is made public. The problem is that after just 2 or 3 days, search engines begin picking up the draft and people start posting comments.

I don't want to password protect the draft. Is there some way to hide it from search engines while it is in the 'Uncategorized' category?

share|improve this question
Keep in mind that not all search engines honor a noindex request. – Stephen Feb 14 '13 at 18:39
up vote 3 down vote accepted

How about something like this on your functions.php:

add_action('wp_head', 'no_robots_on_uncategorized_posts');
function no_robots_on_uncategorized_posts() {

    if(in_category('uncategorized')) {


This will output the following line of code on the header of your 'uncategorized' posts:

<meta name='robots' content='noindex,nofollow' />

What this means is that even though search engines will see the page, they will be told to ignore it and don't show it on their results.

share|improve this answer

Something like this in your robots.txt?

User-agent: *
Disallow: /category/uncategorized/*

Since there is no link anywhere in your blog, you should only be concerned by the category archives; in this way search engines should not crawl those parts of your site. Is there any other way that your drafts are accessible? You might consider also modifying the category-uncategorized.php template file, so that those posts are in no way accessible without having a direct link.

share|improve this answer
Thanks. I display only a customized archive. What kind of modification would category-uncategorized.php need? Do you have some kind of example? – 4thSpace Feb 14 '13 at 17:02
Well, to make it inaccessible you could just do something as simple as wp_die("We are sorry, but this category is not accessible"), or you could make a conditional which makes the loop available only if the user_role is contributor. You have different solutions, but if you are worried only of search engines and not users trying to access that archive by manually typing the URL, the first robots.txt solution should do. – Sunyatasattva Feb 14 '13 at 17:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.