[wp-trac] [WordPress Trac] #11691: Tag cloud widget: Add support for nofollow

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 2 17:10:36 UTC 2010

#11691: Tag cloud widget: Add support for nofollow
 Reporter:  trick77      |       Owner:  azaozz    
     Type:  enhancement  |      Status:  new       
 Priority:  normal       |   Milestone:  Unassigned
Component:  Widgets      |     Version:            
 Severity:  minor        |    Keywords:  has-patch 

Comment(by nacin):

 Replying to [comment:10 trick77]:
 > Nevermind... I won't discuss SEO with you.
 Well, for reference, here is Matt Cutts on sculpting:

 > I tried your suggestion with the API filter using
 > add_filter('wp_generate_tag_cloud', 'wp_rel_nofollow');
 > but that just leaves me with a destroyed tag cloud because the function
 inserts backslashes everywhere.

 Sorry, wp_rel_nofollow() is for the pre_comment_content filter, so it
 escapes in preparation for the comment to be inserted into the db. You'd
 need to use this, which steals a line from wp_rel_nofollow() and uses its
 helper callback:

 add_filter( 'wp_generate_tag_cloud', 'my_nofollow_tag_cloud_example' );
 function my_nofollow_tag_cloud_example( $text ) {
    return preg_replace_callback('|<a (.+?)>|i',
 'wp_rel_nofollow_callback', $text);

 Again, I feel this doesn't belong in core for various reasons mentioned

Ticket URL: <http://core.trac.wordpress.org/ticket/11691#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list