WordPress themes while displaying author bio and comments use the get_avatar
function to retrieve the avatar.
get_avatar
function requests avatar from Gravatar. If gravatar returns a image then get_avatar
functions returns that image otherwise returns the default image. WordPress by default provides some default images, you need to select any one. You can also add more default images using this code
function newgravatar ($avatar_defaults)
{
//url of the avatar
$myavatar = "http://qnimate.com/wp-content/uploads/2015/03/unknown.png";
$avatar_defaults[$myavatar] = "Anonymous";
return $avatar_defaults;
}
On Settings › Discussion page you would see this
In either cases get_avatar
function passes the final image through the get_avatar
filter before returning the image.
Note: If you have disabled avatar on Settings › Discussion page then get_avatar
function simply returns false and doesn’t do any of the above stuff.
Leave a Reply