WordPress Query Multiple Taxonomies
June 29, 2011
wordpressThis 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!
Show Comments