Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
1  
please post your wp_list_comments() section and what have you tried so far. –  peteroak Aug 3 '12 at 6:22

1 Answer 1

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

 
discard

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.