您可以使用特定的比较操作创建meta\\u查询组,并且由于您希望在单个自定义字段中基于订单,因此可以将订单声明专用于单个meta字段。因此:
$q = new WP_Query(
array(
\'meta_key\' => \'population\', //setting the meta_key which will be used to order
\'orderby\' => \'meta_value\', //if the meta_key (population) is numeric use meta_value_num instead
\'order\' => \'DESC\', //setting order direction
\'meta_query\' => array(
\'relation\' => \'AND\', //setting relation between queries group
array(
\'relation\' => \'OR\', //setting relation between this inside query
array(
\'key\' => \'state\',
\'value\' => \'Wisconsin\',
),
array(
\'key\' => \'timezone\',
\'value\' => \'central\',
)
),
array(
\'key\' => \'city\',
\'compare\' => \'EXISTS\',
)
)
)
);