Is your post type non-hierarchical like a post – or hierarchical like a page?
It will determine which slug parameter you should be using in WP_Query:
name (string) - non-hierarchical (post) slug.
pagename (string) - hierarchical (page) slug.
Also, the tax_query should have the operator parameter. Possible values are ‘IN’, ‘NOT IN’, ‘AND’. You should set it to ‘AND’.
This could be a solution:
$args = array(
'post_type'=>'specialist',
'postname' => 'test',
'tax_query' => array(
array(
'taxonomy' => 'type',
'field' => 'slug',
'terms' => 'therapist',
'operator'=> 'AND'
)
)
);
$specialists = new WP_Query($args);
If it really isn’t working, then you could always do a workaround by creating a filtering function to add the where clause to the query
function filter_where( $where="" ) {
// post_name
$where .= " AND $wpdb->posts.post_name="test"";
return $where;
}
add_filter( 'posts_where', 'filter_where' );
$query = new WP_Query( $args );
remove_filter( 'posts_where', 'filter_where' );