Duplicate content comment pages

Duplicate content is very important ranking every website. It has a negative influence on Google Page rank. To avoid the drop of page rank it is necessary to check for duplicate content on your Website.Adding this PHP code to the functions.php of your wordpress theme will prevent duplicated content as a result of multiple comments pages.

 

 

function canonical_for_comments() {
global $cpage, $post;
if ( $cpage > 1 ) :
echo "n";
echo "<link rel='canonical' href='";
echo get_permalink( $post->ID );
echo "' />n";
endif;
}
add_action( 'wp_head', 'canonical_for_comments' );

Leave a comment