Remove a page or post in Search Engines

Remove a page or post in Search Engines

Sometimes you don’t want to crawl a single page or some posts to the robots of Google, Yahoo, Bing, etc.

Now I will teach you how not the a page or post to be crawled by robots. You can add this code on your header.php.

1. using is_page function of wordpress

Using the is_page function you will check if the page id is current page your are viewing. When it is the page, the code below will put a meta tag with noindex and nofollow in your header. when the robot see this the page will not be index on search engines.

OR using this code if you have multiple page. you will add your slug, page title, or page id in an array.

2. on a post using is_single

OR

3. using $post->ID

This one is the same as the above function is_page, it check if the current page is the page id and it will add also meta tag on the header.

CONCLUSION

Any of the above solution can help you to set a page that will not crawl by google. If we need some privacy on that page but can still be viewed. also those code can also be use not only adding meta tags it can be other.