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'
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.

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('||i', '', $text);
return $text;

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

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

  1. 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. 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.



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


    (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. 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.

  5. Pingback: Dogberry Patch
  6. Pingback: theladderproject
  7. 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.

  8. 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.

  9. 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.

Comments are closed.