Family Encyclopedia >> Electronics

How to hide a WordPress page from Google

Recently one of our readers asked if it was possible to hide a WordPress page from Google. Sometimes you may need to hide a page from Google to protect your privacy or to keep unwanted users away. In this article, we'll show you how to hide a WordPress page from Google without affecting the overall SEO of your site.

Hide 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 by using HTML meta tags.

We will show you how to do this in WordPress using two methods. You can choose the one that suits you best..

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, this approach will allow you to control the visibility of your posts and pages for all users.

Video Walkthrough

Subscribe to WPBeginner

If you don't like the video or need more instructions, continue reading.

Method 1:Hide a WordPress page from search engines using Yoast SEO

This method is easier and recommended for beginners.

The first thing you need to do is install and activate the Yoast SEO plugin. For more details, check out our step-by-step guide on how to install a WordPress plugin.

If you are not familiar with Yoast SEO, you can refer to our guide on how to install and configure the Yoast SEO plugin.

Next, you need to edit the post or page that you want to hide from search engines. Navigate to the Yoast SEO metadata box below the post editor and click the advanced settings button.

The advanced settings section allows you to add meta tag bots to your blog posts or pages. Using the robots meta tag, you can tell search engines not to index or follow a page.

You must first select 'noindex' from the dropdown menu next to the 'Meta robots index' option. After that, click on 'nofollow' next to 'Meta robots follow' option.

Now you can save/publish your post or page.

Yoast SEO will now add this line of code to your post or page:


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

Method 2:Hide a WordPress page from search engines using the robots.txt file

This method requires you to edit the robots.txt file. Adding incorrect instructions in this file can have an adverse effect on the SEO of your site, so it is not recommended for first-time users.

The robots.txt file is a configuration file that you can add to the root directory of your WordPress site. It allows a website to provide instructions to search engine robots, hence the name robots.txt.

For more information, check out our guide on how to optimize your WordPress text file for SEO.

You can edit the robots.txt file by connecting to your website using an FTP client or 'File Manager' on your WordPress cPanel server.

You will need to add these lines to your robots.txt file.

The user agent line allows you to target specific bots. We are using the asterisk signal to include all search engines.

The next line defines the part of the URL that comes after your domain name.

Now let's say you want to hide a blog post with a URL like this:

Here is how you will add this URL to your robots.txt file.

Don't forget to save your changes and upload the robots.txt file to your server.

Disadvantages of using robots.txt to hide content

You should first note that the robots.txt file is publicly accessible. Anyone can access it directly to see if there is any page it is trying to hide.

While most search engines follow the instructions in the robots.txt file, many other crawlers and bots may simply ignore it. These are the bots that crawl the web to spread malware, target websites, or collect information like email accounts, phone numbers, etc.

Method 3: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 protect it with a password, so that only users with the password can see it.

WordPress comes with a built-in feature to password protect posts and pages. Simply edit the post or page you want to protect.

Below the post meta box, click the 'Edit' link next to the 'Visibility' option.

This will display 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 registered users who have at least an editor user role on your website.

Any visitor who has the password can view the password-protected posts. Click on the password protected option and then enter a strong password.

Now you can publish or save your post/page.

Now visitors who access the post or page on your website will be required to enter the password to view the content.

For more detailed instructions, check out our guide on how to password protect posts and pages in WordPress.

That's it, we hope this article helped you learn how to hide a WordPress page from Google. You can also check out our guide on how to prevent search engines from crawling a WordPress site.

If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.