The tax_query attribute is what you need.
You could use it like so:
$query_args = array(
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'slug-of-category-a' ),
),
array(
'relation' => 'OR',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'slug-of-category-b' ),
),
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'slug-of-category-c' ),
),
),
),
);
$query = new WP_Query( $query_args );
Or, taking advantage of the fact that the “IN” operator (that is used in tax_query when querying terms by default) already acts as an “OR” condition, you could also write:
$query_args = array(
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'slug-of-category-a' ),
),
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'slug-of-category-b', 'slug-of-category-c' ),
),
),
);
$query = new WP_Query( $query_args );
This will get posts that are both in A and:
- B,
- C,
- both B and C.
Consult the docs I linked to for more options.