Just found this site via the WP-Hackers List, been using WordPress for years (make a living partially thanks to it) and never stumbled on this site!

Posted this on the WP-Hackers list, but didn't find a solution.

I know WordPress 3.1 has removed the nofollow attribute from the comment Reply link (WordPress 3.1 beta looks good), but was working on something theme wise that should also work with removing the nofollow attribute from the link for WordPress 3.0.3 and below, but can't get it working.

from /wp-includes/comment-template.php

 } else {
  $link = "<a rel='nofollow' class='comment-reply-link' href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
 return apply_filters('post_comments_link', $before . $link . $after, $post);

In WordPress 3.1 rel='nofollow' has been removed from the above code. I'm trying to achieve the same at theme level for WordPress 3.0.3 and below.

Basically adding this code to the comments loop as a test works:

$comment->comment_content = str_replace('nofollow', 'Test One',$comment->comment_content);

This removes the text nofollow from a comments body.

I tried

$comment_reply_link->reply_text  = str_replace('Reply', 'Test Two',$comment_reply_link->reply_text );

As another test to replace the anchor text of the Reply link to confirm I'm on the right track.

Didn't work.


$comment_reply_link->link  = str_replace('nofollow', '',$comment_reply_link->link );

to delete the nofollow part of the rel attribute.

Didn't work either

Tried a variety of permutations with no joy.

Any ideas?


  • The site is only several months old and still in beta. :)
    – Rarst
    Dec 20, 2010 at 6:47
  • Welcome to WordPress Answers David, have only recently joined myself... :)
    – t31os
    Dec 20, 2010 at 8:41

1 Answer 1



function remove_nofollow($link, $args, $comment, $post){
  return str_replace("rel='nofollow'", "", $link);

add_filter('comment_reply_link', 'remove_nofollow', 420, 4);
  • 420 priority, huh? :)
    – MathSmath
    Dec 20, 2010 at 0:31
  • 2
    Thanks AmbitiousAmoeba, that worked perfectly. Been stuck on that problem for ages.
    – David Law
    Dec 20, 2010 at 2:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.