Remove Nofollow From Commenter Name

Posted under:
October 1st, 2008

There are those of you out there that may in fact want to give back to your commenters by removing the nofollow tag from the commenter’s name area on your blog. While there are plugins that allow you to do this I figured for those of you interested that I would show you how to do it manually.

Before we go digging into and editing the core WordPress files I highly suggest that you BACKUP any file that you intend to edit and change. Don’t hold me responsible for something that you mess up and can’t fix even though I warned you beforehand.

With that said, make your way over to your WordPress installation through FTP or however else you do it. There is only one file and one line to edit to remove the nofollow tag from the commenter’s name so this will go very quick and will be quite easy.

You should be at the default folder for your WordPress installation. The directory that contains the wp-admin, wp-content, wp-includes folders along with the other files. We are going to want to navigate into the wp-includes folder. Inside of the wp-includes folder there will be a .php file named comment-template.php. This is the file we are going to be editing, remember……BACKUP!

Open the file in your text editor and find line number 116. If you don’t have a text editor that shows the line numbers you can use the search feature usually located in one of the menus on the menu bar. If you have to use the search feature you need to make a search for rel=’external nofollow’. For clarification purposes, the surrounding code should look like

if ( empty( $url ) || ‘http://’ == $url )
$return = $author;
else
$return = “<a href=’$url’ rel=’external nofollow’>$author</a>”; <– This line
return apply_filters(’get_comment_author_link’, $return);

Ok, now that you have found the correct line, highlight the rel=’external nofollow’ text and delete it. Save the file and upload it back to your server if needed and you are done! Now when your commenters leave a comment, you can give them some link love by showing Google that you trust their sites. Of course, this method is only advised if you have control over your commenters.

Related Posts

14 Comments

  1. Comment by: Normal Joe

    Good one man, you’re a super hacker! I use plugins to handle my nofollow stuff lol.

    Normal Joes last blog post..Blog Flipping Blueprint Is Here And I Have A Bonus For You

  2. Comment by: Jarret

    Hi Joe :)

    Yes I like to play around in WordPress files ;) I mostly use plug ins as well for my blog but decided to throw this out there for those looking.

  3. Comment by: SuiteJ

    Nice tip. I’m the opposite of Joe actually. I mean, I use lots of plugins that do fairly simple things, but for little hacks like this I prefer to do it in the code as opposed to installing yet another plugin. I have too many as it is!

    Keep ‘em comin!

    Cheers!
    Jay

    SuiteJs last blog post..Don’t Buy Bryan Clark’s Blog Flipping Blueprint Today

  4. Comment by: Jarret

    Yeah, it’s a short little tip.

    Since I redesigned the blog and wanted to head a different direction with it, I wanted to do posts on Wednesdays about WordPress customization. I was going to call it WordPress Wednesdays but it sounded lame…….lol.

  5. Comment by: Freddie

    Wow! That was short and simple. I have a plugin to do this currently, but I may be able to pull this off in the future with my other sites.

    Thanks!

    Freddies last blog post..Monday’s Motivational Moment: Urgency

  6. Comment by: Dennis Edell

    Since I even screwed up a back-up, I’ll stick with plugins LOL

    Dennis Edells last blog post..Coming Soon? Yes They Are I Swear - I Need Your Advice First!

  7. Comment by: Elijah

    Yeah, I’m finding it hard to manage the 15 plug ins I have going right now..

    I’m kinda risky as I will usually edit right in the WP code without backing up or anything - not on TAHC.com though! That’s my bread and beer right now…

    I like this little tweak though, it’s simple and to the point…I’m sure there are plug ins that can do this (like I have) but as Jay said snipping up some code can save some WP dashboard space for sure.

    Elijahs last blog post..Blog Report For September 2008

  8. Comment by: Yan from Blog for Beginners

    While many dread to go anywhere beyond the admin dashboard, here you are telling them to mess around with the php code. But it’s a nice trick, Fred….something I have never done it myself as I rely too much on plugins.

    Yan

    Yans last blog post..The Motive Interactive - Review of Advent 2.0

  9. Comment by: Linux Hacker

    You should make a WordPress fork so people won’t have to change this every time they update their CMS

    Linux Hackers last blog post..Google Cache Versions Merged

  10. Comment by: JR

    I did exactly what you said and I still show the comments as no-follow and the source code shows rel=external no follow” BUT the templeate.php does not.

    Ever since I switched to WP2.7 the NOFF plug-in stopped working it is active and installed but all my comments went no-follow. Not sure what to do next, any suggestions?

    JRs last blog post..Website Traffic that Converts - Are You Missing Out?

  11. Comment by: Jarret

    Hi JR, I just looked into the code for WP 2.7 and realized that the code itself is on a different line then where I stated in the post. This post was written a few months ago so it is somewhat outdated but the overall instructions still apply.

    I figured out how to remove the nofollow from the author name though. Go into your wp-includes folder and open up comment-template.php. Make your way down to line 148 or do a search for

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

    Remove the rel=’external nofollow’, save the file and make sure it uploads back into the proper directory. I just tested this out on WP 2.7 on one of my sites and it did remove the external nofollow.

    If you continue to have problems with it you can post another comment here or get in touch with me using my contact form. Or you can also find me on several differnt IM services:

    Yahoo: jarretcade2003@yahoo.com
    GTalk: jarretcade@gmail.com
    Skype: jarretcade

  12. Comment by: JR

    Thank you so much I will go and try that now, I was up all night trying to figure this out.

    JRs last blog post..Link Building - 7 More Do-Follow Social Sites

  13. Comment by: JR

    The line I found that is closest to what you provided is

    $return = “$before$display$after”;
    return apply_filters(’get_comment_author_url_link’, $return);

    I tried deleting the rel=external and it’s still no-follow, This is driving me completely nuts, I hav even looked through every single line in the template file and I find nothing else that says no-follow, BUT the source code still says rel=”external no follow”, please HELP!!

    JRs last blog post..Link Building - 7 More Do-Follow Social Sites

  14. Comment by: Nofollow | khmerbird.com

    [...] Read the instruction how to remove nofollow [...]

This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.