3 quick ways to hide a WordPress post from search engines

hide a wordpress post from search enginesAll popular search engines, including Google will allow you to hide part of your website’s content from the search results which random users will get. To do this, just use the robots.txt file from your website. Alternatively, you can use HTML meta tags.

In this article we will guide you on how to do this in WordPress. We will explain in detail the two basic methods you can choose from.

We will go even further and show you how to password-protect your WordPress posts and pages. You can use this instead of the aforementioned methods for controlling the visibility of your posts and pages.

Hide a WordPress post with Yoast SEO

This is the easiest and therefore the most beginner-friendly method.

You just have to edit the specific post or webpage that you want to be invisible for search engines. To do this: scroll down to the Yoast SEO meta box which is positioned under the post editor and click on advanced settings (the gear icon).

hide a wordpress post yoast seo

Use the drop-down menu next to ‘Meta robots index’ to select the ‘noindex’ option. Then press ‘nofollow’ which is positioned next to the ‘Meta robots follow’ option.

Now, the Yoast SEO plugin will add the following line of code to your WordPress post or page:

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

This code is used to inform search engines not to index the particular page and not to follow any of the links on it.

Hide a WordPress post with robots.txt file

This method includes editing of the robots.txt file. Since incorrect instructions in the robots file are likely to affect your website’s SEO, it is not a recommended method for beginners.

The robots.txt file is a configuration file and you can add it to your WordPress-based site’s root directory. The file’s sole function is to provide instructions for search engine bots.

You can edit the robots.txt directly from the File Manager in your hosting account. Additionally, you can use any FTP client of your choice. You will have to add the following lines:

User-agent: *
Disallow: /your-page/

These two lines are important, because the first one (user-agent) makes it possible for you to target specific search engine bots. The asterisk sign means that all search engine bots are included.

The second line is used to show URL, which you want to hide.

For example, if you’d like to hide a WordPress post with the following URL – http://example.com/my-blog-post-2017/ – from search engine bots, you have to add its URL to the robots.txt file like this:

User-agent: *
Disallow: /my-blog-post-2017/

Disadvantages of hiding content

Without a doubt the main disadvantage hiding content with meta tags or robots.txt is that they are both publicly accessible.

As a result, even though the page will be hidden from the popular search engines like Google, some bots will ignore these instructions.

This includes bots which are used to spread malware, target websites or harvest user information like e-mail addresses, phone numbers and other kinds of private info.

Also, both methods will not prevents bots from accessing the page or “reading” the content. They will simply stop bots from saving this content to the respective databases.

Advantages of password-protected posts in WordPress

Password-protection is a native WordPress solution. It allows you to hide a WordPress post or a page from the public eye by protecting it with a password. All you need to do is edit the specific post or page that you’d like to hide from search engines.

password protected post wordpress

Click on the ‘Edit’ link which is right next to the ‘Visibility’ option under your Publish meta box.  This way, you will see all of the WordPress visibility options public, password protected or private.

Public posts are available to anyone, who visits your website, while private posts are accessible only to registered users with editor privileges.

All posts that are marked as password protected can be seen only by visitors that know the password. Remember to set a strong password  – use letters (lower and uppercase), numbers and symbols.

Any visitors (both humans and bots) who load the page or post will be required to enter the password you’ve set in order to see the content.