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

When a link is posted in a comment, the format is : rel="nofollow"

Using a function, how can I change that to : rel="external nofollow _blank"

So the links open in a new window?

share|improve this question
please post your wp_list_comments() section and what have you tried so far. – peteroak Aug 3 '12 at 6:22

To replace nofollow with nofollow external _blank

Put this code in your theme's functions.php file to replace text as required.

function wpse_60668_relnofollow($text) {
    $return = str_replace('nofollow', 'external nofollow _blank', $text);
    return $return;

add_filter('get_comment_author_link', 'wpse_60668_relnofollow'); //this'll change author link
add_filter('comment_text', 'wpse_60668_relnofollow'); //This'll change the content
share|improve this answer

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.