How to Make Author Comment Links Do-Follow Without Using a Plugin

Because you don’t need a plugin to remove one word of code for you

By default, WordPress nofollows author comment links. For those of us who would like to reward our commenters with a little link love, there are plenty of plugins available that will remove the nofollow attribute from these links. However, you probably already have a couple of plugins installed that you cannot live out. Add a few more, and you will notice that your blog isn’t running as fast as it used to. This would be bad not only for usability, but due to the fact that page load time is becoming an increasingly important search engine ranking factor. Need more reasons to limit your use of plugins as much as possible? Here’s just two of many: 1) Plugin authors can stop supporting WordPress upgrades at any time. 2) Plugins sometimes will break a new theme installation.

So don’t use a plugin if you don’t have to. Especially if all you need to do instead is remove one word of code, which is all we need to do to remove the link condoms from our author comment links. The thing is (and brace yourself if you have never done this before), we are going to have to alter one of the core WordPress files. I understand how this can be a little scary if you have never done it before (and for good reason, because you can break your entire blog by leaving out a simple bracket when you touch the php), but we are only going to remove a single word in this instance so it will be okay. And I’m going to hold your hand.

Wide awake and ready to go for it? Great! Here’s what to do:

1. Via ftp or however you are most comfortable accessing your core files, open up the WP-includes folder and make a backup copy of the file named “comment-template.php”.

2. Locate this bit of code for the “get_comment_author_link” in the working copy of the file:

[php]$return = "<a href=’$url’ rel=’external nofollow’ class=’url’>$author</a>";[/php]

3. Delete the word “nofollow” and the preceding space so that you are left with this:

[php]$return = "<a href=’$url’ rel=’external’ class=’url’>$author</a>";[/php]

4. Save your file.

5. Check the source code of a page with author comment links (or use a tool like SEO Firefox that highlights nofollow links) to ensure your comment links are now sharing link juice.

Voila, that’s it!

Final thoughts

You should note that since you altered a core WordPress file (version 2.9 in my case), you will need to repeat this process when you upgrade WordPress. If anyone knows how to do this by altering the custom functions file in Thesis, I would love to know as this would eliminate repeating this process each time I upgrade WordPress.

8 Responses to “How to Make Author Comment Links Do-Follow Without Using a Plugin”

  1. Hello Christy,

    Did you know that you have saved me a lot of time? Thanks a million!

    I’ve been searching the whole evening in Goolge just looking for an answer like your post: “make wordpress dofollow without a plugin?” And your post is the only one that gave me the right answer. All others suggested a plugin which is not what I want. I don’t want to use too many plugins just like you.

    For your final thought… I think I will just copy and paste comment-template.php over. That should not take long, right?

  2. Yes, but make a backup of the original … just in case.

  3. Great tip! Unfortunately every time you do an upgrade you’ll lose the changes.. so it may still be best to use a plugin 🙂

  4. I asked that question over on the Thesis forums, and here’s the answer to replace the plugin with a custom function:

    function do_follow_commenters($output) {
    return str_replace(” rel=’external nofollow'”, “”, $output);
    add_filter(‘get_comment_author_link’, ‘do_follow_commenters’);

  5. Thanks buddy, earlier I used the dofollow plugin, but it was not allowing me to nofollow the comment luv links, but your tutorial helped me to do that and also to delete a plugin from my list. Thanks 🙂

  6. Glad to be of assistance!

  7. hi!,I like your writing so so much! share we communicate extra about your
    article on AOL? I need a specialist on this space to resolve my problem.

    Maybe that is you! Having a look forward to see you.

  8. Hi there, thank you for the kind words. I actually need to update this post, as it is now best-practice to no-follow blog post comments.

    What issue do you need help with?

Share Your Thoughts