For example I have custom post type Cars and two custom taxonomies Brand (with terms BMW, Honda, etc.) and Color (Red, Green, etc.).
Car must has Brand but may not have Color.
So it may be like: Car -> Brand : BMW -> Color : Red,
and aslo it may be like this:
Car -> Brand : BMW(without color).
I need to get Cars from 1 brand which has colors: Car -> Brand : BMW -> Colors (any color). I have tryed to create query but it does not work.
$args = array( 'post_type' => 'cars', 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'brand', 'field' => 'slug', 'terms' => 'bmw' ), array( 'taxonomy' => 'color' ) ) ); $query = get_posts( $args ); var_dump($query); die();