WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question
The site is only several months old and still in beta. :) – Rarst Dec 20 '10 at 6:47
Welcome to WordPress Answers David, have only recently joined myself... :) – t31os Dec 20 '10 at 8:41
up vote 5 down vote accepted


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

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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