我能找到的唯一解决方案是将我的两个值保存为post\\u meta,然后使用以下代码:
$args = array(
\'post_type\' => \'POST_TYPE_HERE\',
\'post_status\' => \'active\',
\'update_post_term_cache\' => false, // don\'t retrieve post terms
\'meta_query\' => array(
\'relation\' => \'and\',
array(
\'key\' => \'META1_NAME\',
\'value\' => $order_id,
\'compare\' => \'=\',
),
array(
\'key\' => \'META2_NAME\',
\'value\' => $product_id,
\'compare\' => \'=\',
)
)
);
$posts_array = new WP_Query($args);