Get the current avatar for logged in user in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Ensure user is logged in | |
if( is_user_logged_in() ) { | |
// Display current logged in user's avatar (includes <img> tag) | |
echo get_avatar( get_current_user_id(), 96 ); | |
// Display current logged in user's avatar URL | |
echo get_avatar_url( get_current_user_id(), array( 'size' => 96 ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment