[wp-trac] [WordPress Trac] #4889: Extend get_terms to add custom joins / wheres

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 1 23:56:46 GMT 2007


#4889: Extend get_terms to add custom joins / wheres
-------------------------+--------------------------------------------------
 Reporter:  arnee        |       Owner:  anonymous
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  2.3      
Component:  General      |     Version:           
 Severity:  normal       |    Keywords:           
-------------------------+--------------------------------------------------
 Example: I want to get all categories which actually have posts.

 - Old way: SELECT... FROM wp_cats... JOIN wp_posts... WHERE
 post_status='publish'

 - New way: get_terms("category")

 The problem is that I can't specify any properties of the related object
 so I would have to use direct SQL again instead of a clean API function.

 Solution: Extend get_terms to add properties of the related object.
 get_terms should know which table needs to be joined via the object_type
 property.

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


More information about the wp-trac mailing list