first_name
和last_name
存储在usermeta
桌子因此,您必须使用get_user_meta()
返回这些数据。请尝试以下代码段:
$users = get_users(array(
// blog_id is not required and will be set by WP_User
\'role\' => \'sm_flagar\'
));
foreach ($users as $user) {
$firstName = get_user_meta($user->ID, \'first_name\', true);
$lastName = get_user_meta($user->ID, \'last_name\', true);
echo \'<li><a href="\' . $user->user_url . \'">\' . $firstName . \' \' . $lastName . \'</a></li>\' . PHP_EOL;
}