Hiding a WordPress Post or Page From Google

Search engines like Google allow website owners to exclude content from search results. You can do this by using your site’s robots.txt file or using HTML meta tags.
We will show you how to do this in WordPress using two methods. You can choose the one that works best for you.
We will also show you how to password protect posts and pages in WordPress. If you don’t want to use the first two methods, then this approach will allow you to control the visibility of your posts and pages for all users.

Method 1: Hide a WordPress Page from Search Engines Using Yoast SEO

This method is easier and recommended for beginners.
First thing you need to do is install and activate the Yoast SEO plugin. For more details, see our step by step guide on how to install a WordPress plugin.
If you are new to Yoast SEO, then you may want to see our guide on how to install and set up Yoast SEO plugin.
Next, you need to edit the post or page that you want to hide from search engines. Scroll down to the Yoast SEO meta box below the post editor and click on the advanced settings button.

The advanced settings section allows you to add meta tag robots to your blog posts or pages. Using the robots meta tag, you can tell search engines not to index or follow a page.
First you need to select ‘noindex’ from the drop down menu next to ‘Meta robots index’ option. After that, click on ‘nofollow’ next to ‘Meta robots follow’ option.
You can now save/publish your post or page.
Yoast SEO will now add this line of code to your post or page:

1
<meta name="robots" content="noindex,nofollow"/>

This line simply tells search engines not to follow or index this page.

Method 2: Password Protect a Post or Page in WordPress

This method uses a different approach. Instead of asking search engines not to index a page, you can password protect it, so that it is only visible to users with the password.
WordPress comes with a built-in feature to password protect posts and pages. Simply edit the post or page that you want to protect.
Under the publish meta box, click on the ‘Edit’ link next to ‘Visibility’ option.

This will show the visibility options available in WordPress. You can keep a post/page public, make it private, or password protect it.
Private posts are only available to logged in users who have at least editor user role on your website.
Password protected posts can be seen by any visitor who has the password. Click on password protected option and then enter a strong password.

You can now publish or save your post/page.
Now visitors accessing the post or page on your website will be asked to enter the password to view the content.

Relevant Plugins: