Are you looking for a way to hide a WordPress page from Google?
Sometimes you may need to exclude a page from appearing in Google search results as it is not relevant to your site’s content, to protect your privacy, or to keep away unwanted users.
In this article, we will show you how to hide a WordPress page from Google without affecting your site’s overall search engine optimization (SEO).
Why Hide a WordPress Post or Page from Google
Search engines like Google allow website owners to exclude content from search results.
You can hide WordPress blog posts and pages that don’t have any relevance to the general public such as a page you might have to create for website ownership verification.
Another situation where excluding WordPress pages from search results is beneficial is if you have a membership website. You can hide the profile pages of your members from appearing on search engines.
Hiding content from Google is also helpful if your website is under development, and you want to share a sneak preview with your audience. This way Google won’t index an unfinished website in its search results.
Besides that, excluding pages that have private or sensitive information helps to protect your privacy and prevent confidential information from falling into the wrong hands.
In this article, we will cover different ways to hide WordPress pages from Google including using a HTML meta tag, using your robots.txt file, or password protecting your pages.
You can choose the method that best suits you:
- Method 1: Hide a WordPress page from search engines using AIOSEO (Recommended)
- Method 2: Hide a WordPress page from search engines using robots.txt file
- Method 3: Password protect a post or page in WordPress
Method 1: Hide a WordPress Page from Search Engines Using AIOSEO
This method is the easiest and recommended for beginners.
You can also use the free version of AIOSEO plugin which also comes with the ability for you to hide pages from Google.
After installing and activating the plugin on your WordPress site, you need to edit the page or post that you want to hide from Google.
In the WordPress content editor, simply scroll down to the AIOSEO Settings and click on the ‘Advanced’ tab.
You will now see an option for Robot Setting and a toggle that says Use Default Settings. You need to click on the toggle to switch off the Robot Setting.
Once you do that, more options will appear under Robots meta. To exclude the page from appearing in Google search results, you need to check the box that says No Index.
After you select that, you can save or publish your page. AIOSEO will add a line of code that tells the search engines like Google to not index this page.
The automatic code will look like this:
<meta name="robots" content="noindex"/>
Aside from excluding specific pages, AIOSEO also lets you hide different sections of content from appearing on Google.
To do that, go to All in One SEO » Search Appearance from your WordPress admin area.
You will see different tabs for different content sections, including Content Types, Taxonomies, Media, and Archives.
Now click on any of these tabs and set the Show in Search Results setting to No.
If you want to hide media files from Google, then you will need AIOSEO Pro version to view the options under the ‘Media’ tab.
After that, click the ‘Save Changes’ button.
AIOSEO will add a noindex HTML meta tag, so the search engines will not index the content, and it will not appear in the search results.
It will also exclude the content from your XML sitemaps.
Method 2: Hide a WordPress Page from Search Engines Using 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 your site’s SEO, which is why it is not recommended for beginner users.
The robots.txt file is a configuration file that you can add to your WordPress site’s root directory. It allows a website to provide instructions for search engine bots, hence the name robots.txt.
For more information, take a look at our guide on how to optimize your WordPress robots.txt for SEO.
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 asterisk sign to include all search engines.
The next line defines the part of the URL that comes after your domain name.
Now let’s assume that 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 robots.txt file back to your server.
Disadvantages of Using robots.txt to Hide Content
First, you need to keep in mind that robots.txt file is publicly accessible. Anyone can access it directly to see if there are any pages you are trying to hide.
While most search engines follow the instructions in robots.txt file, many other crawlers and bots may simply ignore it. These are the bots crawling the web to spread malware, target websites, or harvest 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 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 Document setting in your WordPress editor, click on the link next to the ‘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.
For more detailed instructions, see our guide on how to password protect posts and pages in WordPress.
That’s all, we hope this article helped you learn how to hide a WordPress page from Google. You may also want to see our guide on how to install Google analytics in WordPress to see user stats, and our comparison of the best drag & drop page builders for WordPress.