Photo of man lounging in bed using laptop to access WordPress with headphones

How to No-Index a WordPress Post and Hide it From Google

Normally, you don’t want your web pages to be hidden from search engines. You’ll usually want your website and its content to be as visible as possible. However, there are exceptional circumstances when you’ll need to hide a page from Google and other search engines.

You may do this to protect private pages, restrict paid content, or encourage search engines to ignore pages you won’t need to keep around for long – such as content built to promote one-time events. The good news is that whether you’re comfortable making changes manually to your website or not, there are methods you can use to hide a WordPress page.

In this article, we’ll discuss how to hide (or ‘no-index’) a WordPress page from Google and other search engines. Let’s get started! 

Pros/Cons of Hiding a Page

Before we go any further, it’s important to note that we’ll use the term ‘page’ throughout this article. However, everything we’ll be discussing also applies to posts and other web content.

As with anything else, there are pros and cons to hiding a page from search engines. The benefits include that you can:

  • Track website analytics to determine where traffic is coming from. You may want to keep your analytics clear of search engine traffic, in order to get an exact picture of how your marketing campaigns are performing.
  • Hide short-term events. Pages created for short-term purposes, such as for webinars, conferences, or product launches, do not generally need to be indexed. If you don’t hide these pages, they might still show up in search engine results years after your event is completed.
  • Promote a specific page on your website. If you have multiple SEO-optimized pages with similar content, search engines will prioritize one of those pages. Therefore, if you’ve created a page specifically designed to promote a product, you’d want all available traffic routed to it. You can do this by hiding the other pages.

However, there are also a few drawbacks:

  • Hidden pages won’t be found through searches. This is an obvious disadvantage. Hiding your pages means they won’t be indexed by search engines, and users won’t find them by conducting searches.
  • Not everyone will respect your no-index request. Although most search engines will respect your request to hide certain pages, malicious bots and crawlers will not. Examples include bots that spread malware or steal personal information like email addresses, phone numbers, and more.

It’s up to you to decide whether the pros outweigh the cons for your specific content. In case you decide you do want to hide one or more pages from search engines, let’s look at three methods that will get the job done.

Method 1: Using Robots.txt

Our first method includes editing your site’s robots.txt file, to include a command telling search engines not to index your page. This file is located in the root directory of your website’s server. It contains instructions that tell search engines how to find and extract content from your site.

We’ll use one of four available commands, Disallow, to hide a page. Note that you can find and edit your site’s robots.txt file via File Transfer Protocol (FTP). Another option is to access the file manager in cPanel through your hosting provider.

Once you’ve located the relevant file, you’ll need to add the following lines to it:

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

Each of those lines contains a ‘key/value’ pair. For example, “User-agent” is the key on the first line, and the asterisk is the value.

The asterisk indicates that your commands should be applied for all search engines. If you wanted, you could instead restrict this command to just Google:

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

The second line contains the link to the page you’d like to hide. You’ll want to replace “/your-page/” with the URL of the relevant page. Once you’re done, make sure to save the file and upload it back to your server.

Method 2: Using a Plugin

Our second method involves using the Yoast SEO plugin. This is arguably more straightforward than the previous technique.

Once you’ve installed and activated the plugin, find the page you’d like to hide by navigating to Page > All Pages or Posts > All Posts. You’re looking for the collapsed Advanced tab in the SEO meta box, below the page editor:

Screenshot of how to use a plugin to no-index a WordPress post

Once you find the Advanced tab, you’ll want to select “No” from the drop-down menu under Allow search engines to show this Page in search results?:

Screenshot of disallowing search engines to find a post in WordPress

Make sure to save your page, or hit the Update button if it’s an existing page. Now, search engines will be informed not to index your page or to de-index it.

Method 3: Password Protecting the Page

WordPress provides a feature that enables you to protect a page by setting a password for it. This means that only users with the password can access that page. Note that if your goal is to hide content from visitors rather than search engines, this is the recommended method.

The two techniques discussed above will only prevent your page from showing up in search results. Anyone with the correct URL can still access it. So you may want to use this method in combination with one of the other options.

To set a password for a page, open it up in the WordPress editor. Then look for the Status and visibility section under the Document tab. By default, pages are set to ‘public’, so you’ll want to click on the Public link right next to Visibility:

Screenshot of how to set up a password for a WordPress post

Next, select the option labeled Password Protected, and enter a password into the accompanying text input box:

Screenshot of making a WordPress post password protected

You should notice that the link has changed from Public to Password Protected:

Screenshot of how to set a link from public to password protected

Now when someone tries to visit this page, they’ll need to enter a password before they can view it:

Screenshot of where to enter a password to view a password protected WordPress post

You’ll want to ensure that you use a strong password here, so the page can’t be broken into by malicious users.

Stay in Control of Your Site With WP Engine

At times, you may need to restrict access to paid content, hide pages you’ll only need in the short term, or prioritize certain pages on your website. No matter what your reason might be, you can easily hide your pages from search engines using multiple methods.

Staying in control of your WordPress website can be a challenging enterprise. However, with quality hosting, top-notch resources, and the right WordPress security solutions, you’ll be on the right track to creating an incredible digital experience!

Get started.

Build faster, protect your brand, and grow your business with a WordPress platform built to power remarkable online experiences.