Add rel=prev & rel=next Meta Tags in WordPress

5/5 - (1 vote)

You need to include the rel=”prev” & rel=”next” meta tags in your WordPress blog. These kinds of meta tags will show Google the relationships of documents that span over multiple pages and distinguish them as a series.
This is certainly great for SEO and helps Google properly index chart your information. Proper indexing means more relevant results to users and more targeted prospects to your site.
It’s quite simple to include these meta tags to the section on your blog.
First, install the following plugin: https://en-ca.wordpress.org/plugins/my-custom-functions/
Second, add the following and clear cache if you have 3w cache installed.

function cor_rel_next_prev_pagination() {
  global $paged;
  if ( get_previous_posts_link() ) { ?>
  <link rel="prev" href="<?php echo get_pagenum_link( $paged - 1 ); ?>">
  <?php
  }
  if ( get_next_posts_link() ) { ?>
  <link rel="next" href="<?php echo get_pagenum_link( $paged + 1 ); ?>">
  <?php
  }
}
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
add_action('wp_head', 'cor_rel_next_prev_pagination');

You should see something like this :

1
2
<link rel="prev" href="http://example.com/">
<link rel="next" href="http://example.com/page/2/">

More information can be found on the Google Webmaster Blog.
rel=prev & rel=next Meta Tags

Tags :
rel=prev & rel=next Meta Tags
Social Share :