我想去拿users
所有信息均使用以下代码。
if($_POST[\'orga_id\']) {
$users_query = new WP_User_Query(array(
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'relation\' => \'OR\',
array(
\'key\' => \'first_name\',
\'value\' => $_POST[\'search\'],
\'compare\' => \'LIKE\'
),
array(
\'key\' => \'last_name\',
\'value\' => $_POST[\'search\'],
\'compare\' => \'LIKE\',
),
),
array(
\'key\' => \'organisation\',
\'value\' => $_POST[\'orga_id\'],
\'compare\' => \'LIKE\',
),
array(
\'key\' => \'available\',
\'value\' => 1,
\'compare\' => \'=\',
),
)
));
} else {
$users_query = new WP_User_Query(array(
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'relation\' => \'OR\',
array(
\'key\' => \'first_name\',
\'value\' => $_POST[\'search\'],
\'compare\' => \'LIKE\'
),
array(
\'key\' => \'last_name\',
\'value\' => $_POST[\'search\'],
\'compare\' => \'LIKE\',
),
),
array(
\'key\' => \'available\',
\'value\' => 1,
\'compare\' => \'=\',
),
)
));
}
//$users_found = $users->get_results();
$args = array(
\'fields\' => \'all\',
\'orderby\' => array( \'last_name\' => \'asc\', \'first_name\' => \'asc\' ),
\'meta_query\' => $users_query,
);
$users2 = get_users($args);
但我得到的信息很少,像下面这样。
ID: "548"
display_name: "AaronKew"
user_activation_key: ""
user_email: "[email protected]"
user_login: "AaronKew"
user_nicename: "aaronkew"
user_pass: "$P$BauZua136ZxKPY9Nu2FpmZT1LRmOLr1"
user_registered: "2022-02-06 03:17:50"
user_status: "0"
user_url: ""
我不想
first_name
和
last_name
用户数量。