很接近了,语法有点偏离。我不太清楚您需要查询哪些术语,但这应该是您的论点的结构:
$query = new WP_Query(
array(
\'post_type\' => \'product\',
\'orderby\' => \'name\',
\'order\' => \'ASC\',
\'tax_query\' => array(
array(
\'taxonomy\' => \'product_cat\',
\'field\' => \'term_id\',
\'terms\' => $ids_of_product_cat_terms,
),
array(
\'taxonomy\' => \'product_brand\',
\'field\' => \'term_id\',
\'terms\' => $ids_of_product_brand_terms,
),
),
)
);
阅读
tax queries from the codex.