[wp-hackers] Get non empty taxonomy terms, restricted by post type.
Tom Barrett
tcbarrett at gmail.com
Thu Jan 19 15:16:35 UTC 2012
I have a noddy solution: loop through all the terms checking each one to
see if contains posts with the right post type, adding any to an exclude
array that do not. I expect it can have some performance issues reasonably
quickly.
http://pastebin.com/MDPGaRAz
On 19 January 2012 12:52, Tom Barrett <tcbarrett at gmail.com> wrote:
> If I have a taxonomy spanning multiple post types (specifically, I have
> added core categories to a 'books' product type), how do I find all the non
> empty category terms for 'books'. I.e. exclude category terms that are used
> posts, pages e.t.c.?
>
> I can't see any arguments or filter hooks where I can change the behaviour
> of wp_dropdown_categories() or get_terms().
>
> --
> http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> http://twitter.com/tcbarrett
>
--
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett
More information about the wp-hackers
mailing list