[wp-hackers] CVS: wordpress/wp-includes comment-functions.php

Owen Winkler ringmaster at midnightcircus.com
Sat Jan 22 17:11:22 GMT 2005


Robert Deaton wrote:

>Well, at the moment I'm a bit confused as to whether it can be easily
>switched on and off or not. Matt said in the other nofollow thread
>that it was all done by filters, so they could be easily removed, but
>now some people in this thread are saying its not that simple. I guess
>I'll have to check the latest copy out of CVS and give it a try,
>unless someone can confirm that it is indeed just a filter.
>  
>
Check out one of the changes:
http://cvs.sourceforge.net/viewcvs.py/cafelog/wordpress/wp-includes/functions-formatting.php?r1=1.61&r2=1.62&sortby=date

make_clickable() is registered as a plugin on 'comment_text'.  So if a 
comment is submitted with a URL (not a tag in this case, but just a URL 
in text) it is converted to a working <a> link with rel="nofollow".  You 
*can* disable the filter, but then you also disable the feature of 
turning raw URLs into working links.

A better solution would be to write a single do_nofollow() function and 
register that as a filter on 'comment_text' so that it executes after 
all of the other registered filters.  Then if it's disabled, it doesn't 
affect the existing features.  wp_rel_nofollow() does this, but it's not 
registered for 'comment_text', only 'pre_comment_content'.

It's also not possible to explicitly disable nofollow on 
get_comment_author_link().  Instead, you must *add* a plugin to replace 
the rel="nofollow" parameter with emptystring.

Even if the code stays as-is, you can still write a plugin to remove the 
attributes pretty trivially.  But the one remove_filter() line won't do 
everything.

Owen





More information about the hackers mailing list