这应该是相当简单的使用Meta_Query 的参数WP_Query 对象
您可以设置关系并设置任意数量的字段:
$args = array(
\'meta_query\' => array(
\'relation\' => \'OR\', //realation
array(
\'key\' => \'color\', //first custom field
\'value\' => \'blue\',
\'compare\' => \'NOT LIKE\'
),
array(
\'key\' => \'price\', //second custom field
\'value\' => array( 20, 100 ),
\'type\' => \'numeric\',
\'compare\' => \'BETWEEN\'
)
)
);
$query = new WP_Query( $args );