How to turn off the nofollow attribute in WordPress 1.5

When Google announced the nofollow attribute, they said that it should remove the motive for comment spamming.

A nobel ideal – however, Google failed to roll it out in a recent overhaul of the comment system in Blogger.

WordPress have included it as the default action in the latest version of WordPress but they haven’t included a switch or toggle to turn it off.

I found the code to be altered to be in wp-includes/comment-functions.php on line 173.

Simply change

rel='external nofollow'

to

rel='external'

and save if you don’t want nofollow on your commenter’s links.

In my case, I’m happy to have nofollow off as I am very vigilant about spam (I custom write my .htaccess file I have wp-hashCash installed and I moderate comments so no spam is ever published on my site).

And I’m not sure I trust Google and how they are implementing the nofollow tag.

UPDATE:
pericat contacted me to say that to completely get rid of all references to the nofollow attribute from WordPress, there are other changes to be made as well.

In the file default-filters.php, delete line 29 –

add_filter('pre_comment_content', 'wp_rel_nofollow', 15);

and in functions-formatting.php you need to delete lines 490-494:


function wp_rel_nofollow( $text ) {
	$text = preg_replace('|<a (.+?)>|i', '</a><a $1 rel="nofollow">', $text);
	return $text;
}</a>

and you also need to delete from the make_clickable function on lines 482-489, the code

 rel='nofollow'

– there’s a leading space in front of the rel

If you enjoyed this post, make sure you subscribe to my RSS feed!

17 Responses to “How to turn off the nofollow attribute in WordPress 1.5”


  1. 1 pericat

    There appear to be three files with lines of code that affect adding ‘nofollow’ to links. (comment-functions.php, default-filters.php and functions-formatting.php). One of my to-do’s is to edit all of them. Today.

  2. 2 Tom

    Well spotted pericat – when I deleted the nofollow attribute from comment-functions.php, the nofollow attribute disappeared from links to commenters’ sites.

    Checking the files you mention, I did indeed find references to nofollow. I deleted lines 490-494 from functions-formatting.php and line 29 from default-filters.php.

    There are still nofollow references in functions-formatting.php in the make_clickable function (lines 482-488) but I’m not sure how to safely remove these.

    Thanks,

    Tom.

  3. 3 pericat

    Just got done. For that last file, in the make_clickable function, remove this from both lines:

    rel='nofollow'

    (That’s a leading space in front of ‘rel’.)

    Now, off to sort out why and when and how WP flags comments as ’spam’. Seems to be a new classification.

  4. 4 Sunny

    I find it a shame it is so hard to take it off :/
    Couldn’t a plugin be made for that ?

  5. 5 g.

    Sunny: there is a plugin: use DoFollow to turn rel=nofollow off.
    As I just commented in another blog the plugin has the ability to limit display of nofollow-links to only the first N days, which is pretty nice in case something slips through your filter and you can’t care about your blog daily.

  6. 6 Sunny

    Thanks a lot g! Excellent plugin, that’ll make me happy for the rest of the day :D

  7. 7 Angsuman Chakraborty

    You can also use plugin to strip nofollow from WordPress 1.5. Its a zero-configuration plugin. All it does is strip nofollow from comments and comment author url’s in the most efficient way possible without modifying any WordPress code.

  8. 8 chris

    Thank you so much, I have been looking for a tutorial like that. Its ridiculous that this can’t be turned off with just an option in wordpress. A blogger should have total control over their work.

  9. 9 PHP MySql Programmer / Developer

    I’ve left a number of comments on WordPress blogs that I find as inbound links. I’ve been researching this because it makes no sense.

    Seems one is given credit for the link even if the link contains rel=’external nofollow’.

    This is interesting. I’m sure spam is a problem however giving a link is an incentive to posters. Or so I would think.

  10. 10 Flash design

    I was thinking about starting a blog about flash design but it seems to be so problematic that it’s almost to much work to do. I don’t know how to do write the special htaccess files. Is there somewhere I can download some tutorials.

  1. 1 my daily adventures
  2. 2 Dogberry Patch
  3. 3 Cyberoog, die Insel im Web (Blog)
  4. 4 Wordpress - Plugins at the Dogberry Patch
  5. 5 Wordpress - Plugins 2 Checkout at the Dogberry Patch
  6. 6 theladderproject
  7. 7 theladderproject » Blog Archive » The ethics and practices of using nofollow on your site

Leave a Reply