This example is for an employee directory. We created a custom post type called “employee”. For that custom post type we created two custom taxonomies – “type” and “department”. Lets say we want to find employees in the technology department that are programmers.
$args=array( 'post_type' => 'employee', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts' => 1, 'order' => 'ASC', 'orderby' => 'title', 'type' => 'programmer', 'department' => 'technology' ); query_posts( $args ); // loop it
Hopefully this helps if you are looking to query multiple custom taxonomies from custom post types in WordPress. Have questions? Let us know in the comments!




Henry
2 months ago
This is a nice snippet of code. To go one step further, could you capture "type" and "department" from a form? I mean if you had an option list of all departments and a second option list of types and have the website visitor select themselves. How could you do this?
abrudtkuhl
2 months ago
This is assuming you have created the boxes attached to the custom post type available in the editor.
If you want public access to that you could use Gravity Forms. You can set it up to submit a new entry of a custom post type. Pretty slick.
If not – that's an entire blog post altogether
I'll work on a prequel.