How to change default WordPress Gravatar

How to change default WordPress Gravatar

How to change default WordPress Gravatar

If you want to change the default Gravatar on your WordPress site? By adding your own default gravatar image, you can make your comments section branded.
In this article, we will show you How to change default WordPress Gravatar and replace it with your own custom default gravatar image.

How to change default WordPress Gravatar

First, you need to visit Settings » Discussion page and scroll down to Avatars section. This is where you can configure and change gravatar settings on your WordPress site.

 

Using Custom Default Gravatar Image in WordPress

WordPress also allows you to use your own default gravatar images. Here is how you can easily add your own custom default gravatar image in WordPress.
First you need to create an image that you want to use as the default gravatar. This image should be a square, like 250×250 pixels.
Next, you need to upload this image to your WordPress site. Head over to Media » Add New and upload your custom default gravatar image.

Now Add the following code to your theme’s functions.php file or a site-specific plugin.


add_filter( 'avatar_defaults', 'wbcom_new_gravatar' );
function wbcom_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;
}

Don’t forget to replace $myavatar value to the URL of the custom gravatar image you uploaded earlier.
You can now visit Settings » Discussion page and you will notice your custom default avatar added to default avatar choices.

Select your custom default avatar image, and then click on the save changes button.
WordPress will now use your image for users who don’t have their gravatar associated with their email addresses.

Leave a Reply