By default, any links you have in your WordPress comment section have nofollow attribute. Removing nofollow attribute from links in comment section would encourage your visitors to post comments. That is because it provides backlinks to their websites. Would you remove nofollow attribute from links in comments? If the answer is yes, this tutorial is for you. This tutorial will show you how to do this without install a WordPress plugin.

Dofollow commentluv

Method 1: Remove nofollow from comment author link

Open \wp-includes\comment-template.php

To remove nofollow attribute from the author link. Search for:

$return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";

replace above code with the following code and save:

$return = "<a href='$url' class='url'>$author</a>";

There is one disadvantage of the above method. Your comment-template.php file will be overwritten when you update your WordPress site.

Method 2: Using WordPress theme functions.php to remove nofollow

Open your theme functions.php or create one if it does not exist. Add the following code to it. This will remove the nofollow attribute from comment author link and links in comments

function remove_comment_nofollow($string) {
	$string = str_replace(' rel="nofollow"', '', $string);
	return $string;
add_filter('comment_text', 'remove_comment_nofollow');
function remove_auth_nofollow($string) {
	$string = str_replace(" rel='external nofollow'","", $string);
	return $string;
add_filter('get_comment_author_link', 'remove_auth_nofollow');

Once you save the functions.php above, your WordPress will be comment friendly.

What do you think? Do you think it is a good idea to make links in comments without nofollow attribute?

I believe it is a good thing to do. So, I applied the above code to this site to become a Dofollow CommentLuv site. You can check it out and let me know what you think in the comment below.