我希望所有满足任一条件1的用户OR 条件2。按姓氏排序。
如果我接受条件1AND 条件2(\'关系\'=>\'和\'),查询正常。如果我取“relation”=>“OR”,我会得到所有记录和未排序的记录。怎么了?
$args = array(
\'meta_query\' => array(
\'relation\' => \'OR\',
0 => array(
\'key\' => \'user_thema1\',
\'value\' => $kate_name,
\'compare\' => \'=\'
),
1 => array(
\'key\' => \'user_thema2\',
\'value\' => $kate_name,
\'compare\' => \'=\'
)
),
\'meta_key\' => \'last_name\',
\'order\' => \'ASC\',
\'orderby\' => \'meta_value\'
);
$user_query = new WP_User_Query( $args );