您可以在tax\\u查询中使用多个数组,并确保使用and关系,以便它将它们组合在一起,如下所示:
$q->set( \'tax_query\', array(
\'relation\' => \'AND\',
array(
\'taxonomy\' => \'product_cat\'
\'field\' => \'slug\',
\'terms\' => \'CAT A\',
\'operator\' => \'IN\'
),
array(
\'taxonomy\' => \'product_cat\'
\'field\' => \'slug\',
\'terms\' => \'CAT B\',
\'operator\' => \'NOT IN\'
)
));