Change the Default Gravatar in WordPress

Last updated: Omid Bodagh General No comments 1 minute read
Gravatar is one of the things that ruins your site speed (because the avatar is read from an external site).
If you want to change it, put this code at the end of your theme’s functions file. Download a good-looking avatar and use its address in place of the link, so you end up with a nicer Gravatar and better speed at the same time. Then go into the Gravatar settings in WordPress and enable Default Gravatar.
add_filter( ‘avatar_defaults’, ‘wpb_new_gravatar’ );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar = ‘http://example.com/wp-content/uploads/2017/01/wpb-default-gravatar.png’;
$avatar_defaults[$myavatar] = “Default Gravatar”;
return $avatar_defaults;
}

I am an SEO specialist who likes helping businesses get seen on Google. From WordPress to SEO, whatever an online business needs to grow, I can help with it.

Leave a comment