Sometimes, in order to keep unwanted users away and for privacy from search engines like Google & Bing, you might want to hide a page or post in your WordPress Blog.
This article outlines the different methods that allow you to hide your posts / pages. Search engines refer to a file ‘robots.txt’, which act as a reference on pages they should add or ignore to their index.
There are two different ways to do this using WordPress. Apart from these two methods, we will see how to protect your posts in WordPress with a password. This is also something you can use to control the visibility of posts.
Use Yoast SEO Plugin
Using the Yoast SEO Plugin, you can easily turn on / off the visibility for a post. Let’s install the plugin first.
- Click on Plugins and Add New.
- In the search box at the top right, enter Yoast SEO.
- Click on the Install Now button in front of the Yoast SEO plugin.
Once you have installed the plugin, click onActivate to activate it as well.
- Once you have activated the plugin, go into the post / page that you would like to hide from search engines.
Scroll down to the Yoast SEO Meta box and click on the advanced settings button.
- On this page, click on No for the option “Allow search engines to show this post in search results?”
- For the option “Should search engines follow links on this post?” select No as well.
You can now save/publish your post or page.
Once you do that, Yoast will add <meta name=”robots” content=”noindex,nofollow”/> code to your page, thereby hiding it from the search engines.
Using robots.txt file
If you are not a fan of installing a plugin and would rather do it yourself, then you can go ahead with this method. Please note that this requires you to edit the robots.txt file, which has implications on your site’s SEO. If you are not familiar with the robots.txt file, we suggest you use the previous method. The robots file is a file that provides instructions to search engine bots on which page to index and not index, hence the name.
- Log into your HostPapa account. Click on My cPanel and then on File Manager.
- Your website’s file manager will now show up. From here, navigate to your root WordPress directory (in this example, root WordPress directory is public_html)
- Locate the robots.txt file and click on Edit to open the file in Editor.
- Add these lines to your robots.txt file
Now in the above two lines, the User-agent is for you to give commands to specific search engines like Google, Bing. By using a *, we just included all the search engines.
The next line would be the URL of the post you are trying to hide. So if your URL is
You will add
- Click on Save Changes when you are done. Your page is now hidden.
One issue with robots.txt file is that anyone can easily go to the url http://yourwebsite.com/robots.txt and see which pages you are trying to hide.
Apart from this, not all bots respect your disallow rules. For example, bots that do scraping disregard rules in your robots.txt file. The next method would be of much use, if you want to hide a page from everyone’s prying eyes.
Password Protecting Your Content in WordPress
Instead of informing search engines to not follow your page, WordPress has an inbuilt mechanism to hide a page / post with a password.
- Click on the post that you wish to hide.
- On the side, under the Publish meta box, click on Edit next to Visibility.
The options that you have here, apart from Public, is Private or Password Protected.
- If you click on Private, then any user with an editor level access would be able to see this post.
- If you click on Password Protected and set the password underneath, then only users with the password will be able to access the page.
- Click on Save or Publish to update or publish your new post / page.
This will now hide the content and only users with appropriate access can view the page.
If you have any questions or need help, you can always contact HostPapa Support by opening a support ticket. Details about how to open a support ticket are here.