Extend get_terms to add custom joins / wheres
|Reported by:||arnee||Owned by:||anonymous|
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.