There are plenty of reasons you’d want to restrict the visibility of a WordPress page. It can be due to privacy, the page not being relevant or ready for the public, or website design alterations. This ensures that the page content isn’t released to the public and read by visitors, and/or indexed by search engines. Also, remember our list of leading membership plugins for WordPress? They all use some form of visibility restrictions to make content exclusive. But regardless of what your case is, you’ll find a solution below. Let’s get into how to hide a page in WordPress.
1. Make a WordPress page hidden from the public
Making a page in WordPress visible to administrators and editors only works like this:
- Classic Editor: In the Publish meta box, click on Edit next to Visibility and select Private. Click on OK.
- Block Editor: Click on the cogwheel icon in the upper right corner to bring up settings. Click on Public (default setting) in the Document tab, then select Private.
2. Hide a WordPress page via password protection
Now’s the time to cover the membership configuration we’ve mentioned in the beginning. The tools vary, but they all revolve around learning how to password protect a page in WordPress. This stops unauthorized access by other members or visitors and blocks the page from being indexed by search engines. You can even use it to hide the profile pages of your members for their privacy.
Tip. The plugin mentioned in method 2 in the guide above allows you to password-protect categories. This is ideal for concealing lots of WordPress pages at once. Simply assign them under a single category, for example, Hidden, then configure a password for it.
3. Hide a page in WordPress using robots.txt
This method will only conceal the page from search engines, not your visitors. For that, use method 1 or method 4, submethod 2. With that said, let us ask you this. Do you use Yoast SEO as your go-to SEO plugin? If the answer is yes, you can follow our “editing robots.txt through Yoast SEO“ guide. If the answer is no, you can access your WordPress website via FTP. In both cases, you need to find the robots.txt file in the root folder of your WordPress website. If it doesn’t exist, create it yourself. Then, paste this code:
User-agent: *
Disallow: /your-wordpress-page/
Clarification. Replace /your-wordpress-page/ with an actual WordPress page slug. Do not include your website name in front of it.
4. Hiding a page in WordPress with a plugin
If you don’t like passwords nor tampering with your WordPress core files, you can install a WordPress plugin and be done with it. Here are your options:
1. SEO plugin
If you already have Yoast SEO installed, look no further – it already offers a way to protect a page from being crawled by search engine bots. Other SEO plugins have their own way too, so look around. We’ll demonstrate how to noindex a page in WordPress via Yoast SEO:
- Start editing a page in WordPress Classic/Block Editor.
- Scroll down to the Yoast SEO meta box and go Settings (cogwheel icon) and then the Advanced tab.
- Click on the drop-down list under “Allow search engines to show this Page in search results” and select No.
- Under “Should search engines follow links on this Page?” click on the empty circle in front of No.
- Publish a page and it’ll be hidden from search engines. Your visitors can still see it if its visibility is set to Public.
2. Dedicated plugin
Want to keep a WordPress page hidden from both bots and visitors? Many plugins offer this functionality and we’re affiliated with none. However, we’d recommend Search Exclude by Roman Pronskiy in this particular case. By default, the plugin allows you to conceal pages from visitors. This lets you choose a method of noindexing a page. You can follow the steps above to use Yoast SEO. Or, if you don’t like using SEO plugins, you can edit the functions.php file as we showed in method 2 of duplicating posts/pages in WordPress. Paste this code at the end:
function add_meta_for_search_excluded() {
global $post;
if (false !== array_search($post->ID, get_option('sep_exclude', array()))) {
echo '<meta name="robots" content="noindex,nofollow" />', "\n";
}
}
add_action('wp_head', 'add_meta_for_search_excluded');