WordPress allows users to post comments. When a comment is made, a “reply to” comment link is created. This allows individuals to reply to comments by following a direct link to that comment.

The Problem with Comment Reply Links

The problem is a SEO problem. The link will include a unique comment ID. So, when the link is followed, it will go directly to the comment, bypassing the post entirely. So, not only do new visitors miss the post, it allows search engines to follow the link and since the comment link is unique, the search engine will index the comment link. It creates duplicate links to the same post.

In order to solve this problem, you can add a rel=”nofollow” to all your comment reply links. This will tell the search engines not to follow this link.

The Solution to the Problem

Add the following code snippet to your theme’s functions.php file to add a rel=”nofollow” attribute to your comment reply links.

function add_nofollow_to_reply_link( $link ) { return str_replace( '")'>', '")' rel='nofollow'>', $link ); } add_filter( 'comment_reply_link', 'add_nofollow_to_reply_link' );