您的代码不工作,因为foreach
环get_userdata($bloguser->user_id);
线$bloguser
是未知的对象变量。请尝试此代码:
$get_admins = array(
\'role\' => \'admin\',
\'orderby\' => \'user_nicename\',
\'order\' => \'ASC\'
);
$blogusers = get_users( $get_admins );
echo \'<ul>\';
foreach ( $blogusers as $user ) {
echo \'<li>\' . $user->first_name . \'</li>\';
echo \'<li>\' . $user->last_name . \'</li>\';
echo \'<li>\' . $user->user_login . \'</li>\';
echo \'<li>\' . $user->user_email . \'</li>\';
}
echo \'</ul>\';