I have a custom post type with multiple taxonomy types. The issue is focused around just one of them.
I need to display all custom posts that have a taxonomy from featured-vendors checked. Right now, there is just one “featured” , but there may be more in the future, such as “highlight” or “sponsor” or something alone those lines.
But, for now, I just need to go through all the “vendors” custom post type, find ones with “featured” checked inside of the “featured-vendors” taxonomy.
I have some some posts out there that state it’s not possible, but they were either from 2.8 or from the very first of this year and I know WordPress has released at least one update since then.
Thanks in advance!!
Query Custom Post Types by Taxonomy Term
This sample will assume:
the custom post type was registered with the taxonomy and the taxonomy was registerd with
'query_var' =>true
and'hierarchial' => true
The “checked” term will be the parent and any new ones can be added later on as children.
The Code: