April 28, 2015
Working with large sites that have cross-over content, sometimes it’s necessary to know how to bring multiple taxonomies into a single query.
$myquery['tax_query'] = array( 'relation' => 'OR', array( 'taxonomy' => 'category', 'terms' => array('winnipeg'), 'field' => 'slug', ), array( 'taxonomy' => 'event', 'terms' => array('manitoba'), 'field' => 'slug', ) ); query_posts($myquery);
Sourced here.
Or, if you need to target specific Custom Post Types (or exclude others):
$myquery = array( 'post_type' => array( 'post', 'events' ), 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'category', 'terms' => 'calgary-3', 'field' => 'slug' ), array( 'taxonomy' => 'event-region', 'terms' => 'national', 'field' => 'slug' ), array( 'taxonomy' => 'event-region', 'terms' => 'calgary', 'field' => 'slug' ) ) );