Does someone perhaps know a plugin or snippet (besides Yoast’s WordPress SEO) to accomplish this perhaps? Pagination with rel=“next” and rel=“prev”
The only thing I’ve come across seems to be an 3-month old Trac ticket.
Does someone perhaps know a plugin or snippet (besides Yoast’s WordPress SEO) to accomplish this perhaps? Pagination with rel=“next” and rel=“prev”
The only thing I’ve come across seems to be an 3-month old Trac ticket.
Try putting this snippet in your functions.php
<?php
function rel_next_prev(){
global $paged;
if ( get_previous_posts_link() ) { ?>
<link rel="prev" href="https://wordpress.stackexchange.com/questions/36800/<?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
}
}
add_action( 'wp_head', 'rel_next_prev' );
?>
And if you don’t want the next and prev rel links to show up on the singular pages just wrap the output markup in a !is_singular()
if condition