I has written some tutorial How To Remove nofollow on Comments Text. Today tricks I will give another ways to do it, with more complex code and of course better code than before.
The ways to do this is simple as before, only write this code on your functions.php theme files and your are done. So let’s get started it.
// remove nofollow from comments
function do_dofollow($str) {
$str = preg_replace(
'~<a ([^>]*)s*(["|']{1}w*)s*nofollow([^>]*)>~U',
'<a ${1}${2}${3}>', $str);
return str_replace(array(' rel=""', " rel=''"), '', $str);
}
remove_filter('pre_comment_content', 'wp_rel_nofollow');
add_filter ('get_comment_author_link', 'do_dofollow');
add_filter ('post_comments_link', 'do_dofollow');
add_filter ('comment_reply_link', 'do_dofollow');
add_filter ('comment_text', 'do_dofollow');
And done, this code will do automatically the rest. Go to sleep and your WordPress site supported do follow comment because That code will remove all instances of the nefarious “nofollow” attribute from all comment items, including the author link and comment text. This is a great way to automatically remove nofollow with no plugins or hacking required.
Thanks for Thomas Scholz and Digging Into WordPress Authors to share this code
Photos courtesy egotstic




Pingback: Tweets that mention Tutorial Remove all nofollow attributes from comments # WordPress Tricks & Tips -- Topsy.com
Pingback: WordPress for Android | Unlock IMEI Cellphones
Sorry, if I am wrong, but I think you have a mistake on row 4. I think it should look like this:
’~]*)s*(["|"]{1}w*)s*nofollow([^>]*)>~U’,.And a question about row 6: Is a difference between
’ rel=”"‘and” rel=””?Regards, Iurie
Sorry, if I am wrong, but I think you have a mistake on row 4. I think it should look like this:
’~]*)s*(["|"]{1}w*)s*nofollow([^>]*)>~U’,.And a question about row 6: Is any difference between
’ rel=”"‘and” rel=””?Regards, Iurie
Sorry for repeated comments.
I apologize for repeating the comments. I wanted to make them look better but I failed. A preview would have been welcome.