正如我在上面的评论中所说,WP\\u User\\u查询不支持嵌套的子数组。。。所以最后我通过单独的查询解决了这个问题。。。
不确定是否有更有效的方法,但如果有人需要灵感,下面是我对问题的解决方案。
// get ids of first set of users
$authors_query = new WP_User_Query(
array(
\'fields\' => \'id\',
\'role\' => \'author\',
\'exclude\' => array(36, 41)
)
);
$authors = $authors_query->get_results();
// get ids of second set of users
$admins_query = new WP_User_Query(
array (
\'fields\' => \'id\',
\'include\' => array(23, 45),
)
);
$admins = $admins_query->get_results();
// merge ids
$user_ids = array_merge( $admins, $authors );
// get final selection
$user_query = new WP_User_Query(
array(
\'include\' => $user_ids,
\'orderby\' => \'display_name\',
\'order\' => \'ASC\',
)
);