Posted By

alp on 06/06/11


Tagged

wordpress comments nofollow functionsphp


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Kurt


Wordpress: Remove nofollow From Comments


 / Published in: PHP
 

URL: http://toscho.de/2009/no-no-no-nofollow/

  1. /**
  2.  * Remove nofollow From Comments
  3.  * http://toscho.de/2009/no-no-no-nofollow/
  4.  *
  5.  **/
  6. function myfunction_dofollow($str) {
  7. $str = preg_replace(
  8. '~<a ([^>]*)\s*(["|\']{1}\w*)\s*nofollow([^>]*)>~U',
  9. '<a ${1}${2}${3}>', $str);
  10. return str_replace(array(' rel=""', " rel=''"), '', $str);
  11. }
  12. remove_filter('pre_comment_content', 'wp_rel_nofollow');
  13. add_filter ('get_comment_author_link', 'myfunction_dofollow');
  14. add_filter ('post_comments_link', 'myfunction_dofollow');
  15. add_filter ('comment_reply_link', 'myfunction_dofollow');
  16. add_filter ('comment_text', 'myfunction_dofollow');

Report this snippet  

You need to login to post a comment.