| |

How to Hide Pagination Pages from Search WordPress (Yoast SEO)

I have been sharing WordPress solutions for a quite sometime now, recently I stumbled upon on a very serious issue related to SEO. Pagination is a common web design practice that every web designer use to divide content into discrete pages. You can see it on online stores, blogs, forums, and other content-heavy sites.

What is pagination?

Following image shows, how pagination looks like on content-heavy sites:

We all know, pagination pages are for people who browse through our website, but they don’t have any value for search engines except the links which are present on the pagination pages. Indeed, pagination helps manage large amounts of data and improves user experience, but impact SEO. How? Check this image:

Looking at the example image above, I don’t find any value in any of the Google results but they exist on Google search & throughs errors on Google Search Console like duplicate titles, meta description which is how it can affect SEO.

The best practice is, make these pagination pages ‘noindex, follow‘ so that they won’t be indexed but crawlers can read the links on these pagination pages and index them.

To do this, we use simple HTML tag which is designed to talk with search engine robots/crawlers:

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

I’m using Yoast SEO plugin, I thought there will be any option to hide pagination pages in the settings but I failed. After doing some research I figured that, I can actually do it using Yoast’s filter i.e., wpseo_robots.

Hide Pagination Pages from Search WordPress

Here is my code snippet to hide pagination pages from search if you are using Yoast SEO plugin to do SEO of your WordPress site.

Related  Daily WordPress Plugins Roundup – 20 July.2013

How to add filter in WordPress

  • Go to Plugins > Add New
  • Look for Code Snippets, install & activate it
  • Now, from sidebar Snippets > Add New
  • Name your snippet i.e., Hide Pagination Pages
  • Paste the following code in the snippets and activate the snippet.
add_filter('wpseo_robots', 'yoast_hide_pagination_pages', 999);
function yoast_hide_pagination_pages($string= "") {
    if (is_paged()) {
        $string= "noindex, follow";
    }
    return $string;
}

On activation, you will be able to find the meta tag i.e., <meta name="robots" content="noindex, follow" /> in your WordPress site’s source code.

Leave a Reply

Your email address will not be published. Required fields are marked *