I want to show author avatar in post info. So I use
<?php echo get_avatar( get_the_author_meta( 'ID' ) , 80); ?>
But how can I check if user has avatar?
get_avatar()
returns An img element for the user's avatar or false on failure. The function does not output anything; you have to echo the return value.
so you can try something like that
if( get_avatar( get_the_author_meta( 'ID' ) ) == 0) {
// no img code
} else {
echo get_avatar( get_the_author_meta( 'ID' ) , 80 );
}