SEO for WordPress Pagination (Multiple Page Pages / Posts)


graphics for SEO for WordPress multiple page post / page - WordPress Pagination

Introduction: Out of the box, support for SEO (search engine optimization) of WordPress is poor. With the help of WordPress SEO like Yoast WordPress SEO, the WordPress website can be configured to behave in a search engine friendly way. However, custom tweaking is required for WordPress pagination in order to avoid duplicate titles and meta descriptions.

How to create WordPress pagination (multiple page post / page )

For very long posts or pages, it is very easy to split the long text into multiple pages using the tag <!–nextpage–> which must be added in the “text” editor.

how to configure multiple pages for a single WordPress post or page

The pager should be shown right away if configured correctly (the pager is the “Pages: 1 2 3 4 5…” element in the screen capture below).

pager for multiple page WordPress post or page

If you cannot find the pager, you should look into your template file (most likely the single.php) and add the following line of code just after the <?php the_content(); ?>. You can edit the code within the admin interface: Appearance > editor and select single.php, post.php, page.php or any custom templates.

<?php wp_link_pages(); ?>

SEO Implications for WordPress Pagination

However, as said, the multiple page posts or pages created this are not search engine friendly owing to the following reasons:

  • the different pages are considered as separate items by the search engine and thus diluting the content values of the post/page (i.e. less occurrence of keywords, thin contents, etc.)
  • the titles and meta descriptions for all the pages are identical which will give rise to the duplicate titles and meta descriptions issue. You will get the duplicate titles and meta descriptions error in the HTML Improvements section of the Google Webmaster Tool or Bing Webmaster Tool.

duplicate meta descriptions warning in Google webmaster tools

Add Filters in WordPress to Change the Titles and Descriptions to Avoid Duplication with WordPress Pagination

If you do not use any SEO Plugins for WordPress, you might just add the following line of code to the functions.php file located in the theme folder (wp-content/themes/[yourthemename]). It is often advised to change the files in the child theme lest the updates to your theme will overwrite the changes made by you. But for convenience of explanation, just add the following lines of code to the end of functions.php:

/** Add Page Number to Title and Meta Description for SEO **/
if ( ! function_exists( 'multipage_metadesc' ) ){
   function multipage_metadesc( $s ){
      global $page;
      $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
      ! empty ( $page ) && 1 < $page && $paged = $page;
      $paged > 1 && $s .= ' - ' . sprintf( __( 'Part %s' ), $paged );
      return $s;
   }
   add_filter( 'metadesc', 'multipage_metadesc', 100, 1 );
}

if ( ! function_exists( 'multipage_title' ) ){
   function multipage_title( $title ){
      global $page;
      $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
      ! empty ( $page ) && 1 < $page && $paged = $page;
      $paged > 1 && $title .= ' - ' . sprintf( __( 'Part %s' ), $paged );
      return $title;
}
add_filter( 'title', 'multipage_title', 100, 1 );
}

The multiple paged posts and pages will now show “[Title] – Part 1” and so on for different pages of the post/page. You might like to change the text bolded in the above code (i.e. ” – ” and “Part ” above to change it) to read different. E.g. Change “Part” to “Page”. Below is the result of such implementation:

page number added to title and meta description

For Yoast WordPress SEO Plugin

Change ‘metadesc’ and ‘title’ to ‘wpseo_metadesc’ and ‘wpseo_title’ respectively if you are using Yoast WordPress SEO Plugin as follows:

/** Add Page Number to Title and Meta Description for SEO **/
if ( ! function_exists( 'multipage_metadesc' ) ){
   function multipage_metadesc( $s ){
      global $page;
      $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
      ! empty ( $page ) && 1 < $page && $paged = $page;
      $paged > 1 && $s .= ' - ' . sprintf( __( 'Part %s' ), $paged );
      return $s;
   }
   add_filter( 'wpseo_metadesc', 'multipage_metadesc', 100, 1 );
}

if ( ! function_exists( 'multipage_title' ) ){
   function multipage_title( $title ){
      global $page;
      $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
      ! empty ( $page ) && 1 < $page && $paged = $page;
      $paged > 1 && $title .= ' - ' . sprintf( __( 'Part %s' ), $paged );
      return $title;
   }
   add_filter( 'wpseo_title', 'multipage_title', 100, 1 );
}

Conclusion

However, owing to the difference in implementation of SEO plugins, the above solution may or may not work as expected. In such circumstances, a complete code inspection might be needed to change the title and meta descriptions to avoid duplications for Wordpress pagination (multiple page post / page).

GreyCampus PMP online training course bundle for US$149 only

Support website running for FREE, thanks!

If you find this post helpful and if you are thinking of buying from Amazon, please support the running cost of this website at no extra cost to you by searching and buying through the search box below. Thank you very much for your help!

Edward Chung

Edward Chung aspires to become a full-stack web developer and project manager. In the quest to become a more competent professional, Edward studied for and passed the PMP Certification, ITIL v3 Foundation Certification, PMI-ACP Certification and Zend PHP Certification. Edward shares his certification experience and resources here in the hope of helping others who are pursuing these certification exams to achieve exam success.

You may also like...

Leave a Reply

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

9 Responses

  1. Tom says:

    Thank you, will try this later.

  2. Alejandro says:

    Thanks, helped me a lot!! 🙂

  3. Alex says:

    Great! It’s still works for Yoast even now in december 2016
    It works for my website (under my nick) thanks a lot 🙂

  4. AWP says:

    I using this code for yoast & works! btw, is possible this code make homepage slow load by any chances?
    Sometimes my blog just not response in homepage.. or maybe it’s just my hosting problem.. i don’t really know..

  5. Hey, Thank You so much for this tutorial.

  6. Tweaks says:

    Fantastic – I couldn’t solve problem with my titles of pagination pages until I read this article. Awesome work!

  7. Sachin Dhir says:

    Thanks a lot 🙂
    It solved the problem entirely. No more duplicate titles & descriptions.

  8. ibay says:

    Thank you, this is SOLVED 100% 🙂

  9. Bhumi says:

    Thank you so much. It solved my issue 🙂