61% of marketers say improving SEO and growing their organic presence is their top inbound marketing priority.

As a WordPress site owner, you likely share this priority and dedicate a lot of time and energy to making sure that your content is found by search engines.

However, there are a number of reasons why you might want to hide some of your content from search results. If you’re having an invitation-only event, for example, then you don’t want visitors to find the page with the RSVP link in a SERP. Or you may have pages with sales presentations or internal communications that are only for internal use.

Whatever the reason, you have a few options for hiding a WordPress page from Google. In this post, we'll show you how.

Grow Your Business With HubSpot's Tools for WordPress Websites

We’ll discuss each of these methods in detail below so you can choose the one that best meets your level of technical expertise.

Use Robots.txt File to Hide WordPress Pages From Google

To hide certain pages from Google, you can edit the robots.txt file in the control panel of your hosting account. Robots.txt is a file located in the root directory of your site that tells Google and other search engine bots which posts and pages to crawl.

To access it, log into your hosting account’s cPanel and click the File Manager icon under the Files section.

File Manager icon under Files section in hosting account's cPanel

Source

In the navigation menu on the lefthand side of your screen, click on the public_html folder. Locate the robots.txt file and click Edit from the menu at the top of your screen.

Locate the robots.txt file in your public_html folder and click Edit from the menu at the top of your screen

Source

It will open in a text editor like Notepad in Windows or TextEdit on a Mac. Delete any existing text and copy and paste the following code:

 

 

   User-agent: *

Disallow: /your-page/

Please note that you’ll need to replace the placeholder text in the Disallow field with the URL path of the page you want to hide. The path is everything after your domain name.

Say, for example, the URL of the page you want to hide is http://www.yoursite.com/2020/1/pricing-page/. Then the code snippet you’ll add to your robots.txt file will look like:

 

 

   User-agent: *

Disallow: /2020/1/pricing-page/

 

You can leave the User-agent field as is since the asterisk means any web crawlers will be instructed not to index this page. If you’d like to hide this page from Google only, then replace the asterisk with “Googlebot” in the user-agent field. Doing so will allow other search engine bots to index the page.

Once you’ve made your changes to the code snippet, save and upload the robots.txt file back to your public_html folder.

upload the robots.txt file back to your public_html folder in your hosting account's cPanel

Source

Google search crawlers will now follow the instructions in this file and not index this page.

While this method is relatively simple for users with some coding knowledge, it may not be for beginners. That’s because any incorrect information added to a robots.txt file will harm your site’s search engine visibility. For that reason, if you don’t have coding skills, you may be better off using a plugin.

Use Yoast SEO to Hide WordPress Pages from Google

If you’d like to avoid coding altogether, you can use the Yoast SEO plugin to hide pages from Google. To start, install and activate the plugin on your WordPress site.

Once it’s been successfully installed and activated, navigate to Pages > All Pages in your WordPress dashboard to edit the page you would like to hide from Google.

Scroll down to the Yoast SEO meta box below the post editor. Along the left side of this window, click on the gear icon to open the plugin’s advanced settings.

the Yoast SEO meta box is below the post editor

Source

Here you can add meta tag robots to tell search engines like Google not to index or follow the page.

Just select Noindex from the drop-down menu under “Meta robots index.” Then click Nofollow under “Meta robots follow.”

select Noindex from the drop-down menu under “Meta robots index" in Yoast SEO plugin settings

Source

You can now save or publish the post. Yoast SEO will add a line of code to the page that looks something like:

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

Search engines will now be instructed not to follow or index this page. If you’d like to hide this page from Google only, and not all search engines, then replace “robots” with “Googlebot.”

Change the Visibility of WordPress Pages

While the above methods will prevent certain pages from appearing in Google search results, any visitors who have (or can guess) the link will still be able to view this content. If you’d like to hide this content from visitors, then you can set up a password to protect it.

There’s no need to install a plugin. WordPress comes with a built-in password protection feature for pages and posts. You just need to navigate to the page that you want to protect and go to the Publish meta box. Then click the link labeled “Edit” next to the Visibility option.

click the link labeled “Edit” next to the Visibility option in the publish meta box

Select the “Password protected” option and fill in your password in the empty input box.

Select the “Password protected” option and fill in your password in the empty input box

Once you click the Publish button, only users who know the password will be able to view the page.

Taking Control of Your Content

Using either of the methods above will enable you to hide a WordPress page from Google search results. Controlling which pages are visible in search and which are hidden will help ensure you put the right content in front of the right people.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

 Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Jan 24, 2020 1:23:55 PM, updated September 01 2021

Topics:

WordPress Website