在WP Docs 你可以找到答案。
我还没有测试过这个片段,但应该是这样的:
$args = array(
\'post_type\' => \'product\',
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'product-ean\',
\'value\' => 123,
\'compare\' => \'=\',
),
array(
\'key\' => \'item-ean\',
\'value\' => 123,
\'compare\' => \'=\',
),
),
);
$query = new WP_Query( $args );