Some users find the default avatar of WordPress quite annoying. In addition to the specific image on your WordPress will make a bigger impression on the reader. Changing your default avatar will help you promote your brand better. With this code below you can change your default gravatar.

First, you need to open the functions.php located in your template directory. If you do not have this file then create a new one and insert the following code:

Code:
add_filter( ‘avatar_defaults’, ‘newgravatar’ );
 
function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo(‘template_directory’) . ‘/images/gravataricon.gif’;
$avatar_defaults[$myavatar] = "YourBlogName";
return $avatar_defaults;
}
In the code snippet, the image is extracted from the theme folder, and it's called gravataricon.gif, and apparently, you will change it to your image name. That is the name of the avatar in the display area in your admin panel options.