How to Noindex WordPress Subpages?

 

How to Noindex WordPress Subpages

If Google search results show your blog subpages like  /page/2/,  follow the simple guide to prevent this.

What does Noindex mean?

The page that should not be indexed in the search engine but it isn’t mean that the search engine should not follow the links on the page.

Subpages in WordPress are basically for navigating the pages from page 1 to page 2 and so on.

No Option available to add No-index in Yoast SEO Plugin

Earlier, the Yoast SEO Plugin was provided an option to Noindex subpages by using Titles & Metas -> Others -> Subpages of Archives -> Noindex. So this option helps to prevent from /page/2/ and further of any archives to show up in the search results. But in the latest version Noindex settings and follow attributes is missing.

So this can potentially harm SEO by indexing subpages with duplicate titles. To stop the search engine from indexing posts or pages on your website is the necessary one.

Method 1: Add the following code in your theme function.php file

On your WordPress admin panel, go to Appearance -> Theme Editor and add the following code in your function.php file.

add_action('wp_head', 'robot_meta_subpage_fix', 1);
function robot_meta_subpage_fix() {
  if(is_paged()) {
    echo "<meta name='robots' content='noindex, follow'/>", "\n";
  }
}

Method 2: Add the following Code to Noindex your subpages:

If you are not a programmer and afraid to add the code in fuunction.php file, just try the 2nd method.

  • Install the “Code Snippet” Plugin.
  • Choose the “Add New” option.
  • Give “Title” (if needed).
  • Now, Paste the following code in the box.
function webapptiv_subpage_fix() {

if(is_paged()) echo '<meta name="robots" content="noindex,follow"/>';

}

add_action('wp_head', 'webapptiv_subpage_fix');

No index subpages

  • Next, Scroll-down and Click on the “Only run on-site front-end” option.
  • Finally, Click on “Save Changes and Activate” button.

Save Changes and Activate button

That’s it. Now, the code snippet in WordPress added successfully.  This can help you to stop indexing your page or post in search engine. If you have any other suggestion, let me know in the comments. Thank you…