[wp-trac] [WordPress Trac] #9227: in get_the_category_list(), filter categories before constructing list

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 24 23:25:40 GMT 2009


#9227: in get_the_category_list(), filter categories before constructing list
-------------------------+--------------------------------------------------
 Reporter:  KevinB       |       Owner:  anonymous               
     Type:  enhancement  |      Status:  new                     
 Priority:  normal       |   Milestone:  Unassigned              
Component:  Template     |     Version:  2.7                     
 Severity:  normal       |    Keywords:  category template filter
-------------------------+--------------------------------------------------
 The template '''function get_the_category_list''' returns a concatenated
 string of category links for an individual post.  The only filtering
 available is on the full concatenated sting, via 'the_category' hook.

 Since filtering the category array directly is greatly preferable for most
 uses, please consider adding the attached patch, or something like it.

 Whatever hook is added should somehow indicate the data context - in this
 case for display.  In filtering post categories, there is the potential
 for non-display situations in which the actual post categories must be
 maintained even though the display filtering hides some from the current
 user.  What we '''should not do''' is apply a single filter inside
 get_the_category or wp_get_object_terms, since themes and plugins may
 already call those functions for multiple data contexts.

 I had considered calling the new hook ''''get_the_category_for_list''''.
 Instead I'm suggesting a more generic ''''get_the_category'''' hook,
 '''passing context''' as the second argument.  That would leave the API
 consistent for possible future use in filtering other contexts.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9227>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list