Best way of getting the user’s avatar
-
I’m trying to get the current logged in user avatar, but have experienced problems doing so with the information available online.
I am using:
$user = wp_get_current_user();
$avatar = get_avatar_url($user->ID, ['size' => 128]);
But sometimes I am getting an empty string even though the user has an avatar or connected with gravatar.Am I missing something
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Best way of getting the user’s avatar’ is closed to new replies.