Recently, one of our readers asked if it was possible to hide a WordPress site from Google? Sometimes you may need to hide a page from Google to protect your privacy or keep unwanted users. This article will show you how to hide a WordPress page from Google without affecting your site’s overall SEO.
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, this approach will allow you to control your posts and pages’ visibility for all users.
Video Tutorial
If you don’t like the video or need more instructions, then 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, see our step by step, the guide on how to install a WordPress plugin.
If you are new to Yoast SEO, you may want to see our guide on installing and setting up the 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 the ‘Meta robots index’ option. After that, click on ‘nofollow’ next to the ‘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 tells search engines not to follow or index this page.
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 harm 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, please take a look at our guide on optimizing your WordPress robots.txt for SEO. Moreover, you can edit the robots.txt file by connecting to your website using an FTP client or ‘File Manager’ in your WordPress hosting cPanel.
You will need to add these lines to your robots.txt file.
User-agent: *
Disallow: /your-page/
The user-agent line allows you to target specific bots. We are using an asterisk sign to include all search engines. So, the next line defines the part of the URL that comes after your domain name. Finally, let’s assume that you want to hide a blog post with a URL like this:
http://example.com/2016/12/my-blog-post/
Here is how you will add this URL to your robots.txt file.
User-agent: *
Disallow: /2016/12/my-blog-post/
Don’t forget to save your changes and upload the robots.txt file back to your server.
Disadvantages of Using robots.txt to Hide Content
First, you need to keep in mind that the 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 the robots.txt file, many other crawlers and bots may 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 to Hide a WordPress Site From Google
This method uses a different approach. Instead of asking search engines not to index a page, you can password protect it only to be visible to users with the password. WordPress comes with a built-in feature to password protect posts and pages. Edit the post or page that you want to protect. In addition, under the publish meta box, click on the ‘Edit’ 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 protects it. So, private posts are only available to users who have at least an editor user role on your website.
Password protected posts can be seen by any visitor who has the password. Click on the password-protected option and then enter a strong password.
You can now publish or save your post/page. So, now visitors accessing the post or page on your website will be asked to enter the password to view the content.
For more instructions, see our guide on how to password protect posts and pages in WordPress.
In conclusion, we hope this article helped you learn how to hide a WordPress page from Google. You may also want to see our guide on stopping search engines from crawling a WordPress site.