I am writing a query to retrieve instances of a custom post type I created called "Specialist". In the query I specify a name and more than one taxonomy.
I want to retrieve just those specialist which respect both parameters.
If I run the two queries separately, the correct specialists are returned but when I integrate the two in one single query, it seems that the post_name takes the priority on the taxonomy.
For example, if I run the query asking for a specialist named test with taxonomy therapist, I have back the specialist called test even if it does not have a therapist taxonomy.
Here is the code:
$args = array(
'post_type'=>'specialist',
'name' => 'test',
'tax_query' => array(
array(
'taxonomy' => 'type',
'field' => 'slug',
'terms' => 'therapist'
)
)
);
$specialists = new WP_Query($args);