how to hide specific post from google search

I have a wordpress blog set up on my site, example “blog.domain1.com”. I have several categories and write posts under each category. I have one specific category that I don’t want google search to show on the results page and also the articles written under this category. I used robots.txt and added this
Disallow: /category/profiles
Disallow: /category/profiles/feed

But when I search the content of the posts by doing site search, it appears in google results. How do I hide these posts from google?
I used a plug in to hide these posts on blog.domain1.com home page, search page.

Read More

Why I am doing this –
I have another domain example “domain2.com” where I cannot install wordpress so I decided to use a parsing script that will fetch content from my other domain for the posts written under that one specific category “profiles”.

How I am doing this –

I created a custom feed script that will have posts only from specific category “profiles”. the url will be like this blog.domain1.com/custom-feed. I use this url on my domain2.com script to show the articles.

Can you please help me to take of hiding these specific posts from google search results so that google doesn’t think I have duplicate content. I had to do this way because of restrictions that I cannot install wordpress there. Also, no resource for me to do manual work by just creating a static page with content on my domain2.com. To automate it, I used a parser script and then whenever an article is written on blog.domain1.com, it will appear on this domain2.com.

Please clarify.

regards

Related posts

Leave a Reply

1 comment

  1. Hook into the action wp_head, test if you are on the category archive or a single post with that category, and print the proper meta element:

    add_action( 'wp_head', 'wpse_91073_noindex' );
    
    function wpse_91073_noindex()
    {
        if ( ( is_singular() && in_category( 'CATEGORY_SLUG' ) ) 
            or is_category( 'CATEGORY_SLUG' )
        )
        {
            print '<meta name="robots" content="noindex">';
        }
    }
    

    Replace CATEGORY_SLUG with the real slug of the category (you can find that in wp-admin/edit-tags.php?taxonomy=category).