$members = get_users(
array(\'role\' => \'company\',
\'orderby\' => \'ID\',
\'order\' => \'ASC\'
)
);
array_map( function($member ){
$member->usermeta = array_map(function($data){
return reset($data);
}, get_user_meta( $member->ID ) );
return $member;
}, $members);
这将返回如下数据
Array
(
[0] => WP_User Object
(
[data] => stdClass Object
(
[ID] => 20
[user_login] => aastha
[user_pass] => $P$BVmRgRiZyZWhMvGszAkquPKX0JjedF1
[user_nicename] => aastha
[user_email] => [email protected]
[user_url] =>
[user_registered] => 2021-11-29 10:43:21
[user_activation_key] =>
[user_status] => 0
[display_name] => aastha
[usermeta] => Array
(
[nickname] => aastha
[first_name] =>
[last_name] =>
[description] =>
[rich_editing] => true
[syntax_highlighting] => true
[comment_shortcuts] => false
[admin_color] => fresh
[use_ssl] => 0
[show_admin_bar_front] => true
[locale] =>
[wm_capabilities] => a:1:{s:7:"company";b:1;}
[wm_user_level] => 0
[name] => btc
[type] => 7
[status] => active
[company_age] => 10
[company_member] => 30
[address] => indoor
[city] => indoor
[pin] => 5454
[telephone] => 5434
[opening_time] => 09:00
[closing_time] => 20:00
[fax] => gfgf
[skull_from] => wednesday
[skull_to] => sunday
[mobile] => 3987665213
[overview] => ghgh
[username] => aastha
[email] => [email protected]
[wesite] => http://www.aastha.com
[skull_logo] =>
)
)
[ID] => 20
[caps] => Array
(
[company] => 1
)
[cap_key] => wm_capabilities
[roles] => Array
(
[0] => company
)
[allcaps] => Array
(
[read] => 1
[level_0] => 1
[company] => 1
)
[filter] =>
[site_id:WP_User:private] => 1
)
);