How To Remove the Nofollow Tag From WordPress Comments

Mitchell Harper recently posted an interesting article on the nofollow link in blog comments. If you are not familiar with the nofollow tag, it tells search engines not to count the link back the the users site which in turn increase page rank and all that fun stuff. So your visitors are leaving a comment, but not reaping any of the benefits of it. The reason for this tag is mostly to discourage spam, but it really doesn’t discourage any spam as the spammers still get their URL to the users viewing the comment.

I have been waiting to remove the nofollow tag from my comments here at Code and Coffee until I was comfortable that no spam was getting through. There is no spam here on Code and Coffee, and if some slip through the cracks and make it onto the site it’s removed quickly. My spam solution consists of Akismet and Spam Karma 2, which does a great job of filtering our spam.

So today I removed the nofollow link from the authors URL in the comments, nofollow tags still remain in the URL’s inside the comment text for the mean time. I will keep it this way as long as this does not get abused. So how can one do the same to their Wordpress blog and spread the link love? Easy, here’s the plug in.

[ftf]
/* Plugin Name: Remove Nofollow
Plugin URI: http://www.seopedia.org
Description: This plugin will remove the nofollow attribute from the comment author URL, but will leave the nofollow to any links withing the comment's body.
Version: 1.0
Author: Cristian Mezei
Author URI: http://www.seopedia.org
*/

function remove_nofollow($nofollow)
{
$nofollow = preg_replace("/rel='external nofollow'>/”,”rel=’external’>”, $nofollow);
return $nofollow;
}

add_filter(’get_comment_author_link’, ‘remove_nofollow’);
?>

[/ftf]

Happy commenting!

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

Thanks. I think it’s the right change. Not to nit-pick, but I am a software developer, so… html element attribute values should be wrapped in double quotes, not single quotes. For standards compliance it would be slightly better to have

$nofollow = preg_replace(”/rel=’external nofollow’>/”,”rel=\”external\”>”, $nofollow);

But I’m just being anal and it’s not necessary.

I actually noticed myself and it took a lot of control not to change it :)
I wanted to copy the plug in, as is, from the author.

Thanks for the feedback, always appreciated.

Sorry, the comment form is closed at this time.