How to change the default Gravatar in WordPress

By Last Updated July 29, 2021

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended. Read more about Affiliate disclosure here.

Don’t you guys remember the ‘mystery man’ gravatar in WordPress? It is the default gravatar WordPress shows if you do not have a custom Gravatar.

Here, I will show you how to change the default Gravatar in WordPress. It is a simple and easy-to-do fix(It’s not a technical bug but for me, it just seems really boring when all ‘non-gravatar’ people are getting the same picture.)

Steps to change the default WordPress Gravatar.

Go to your WordPress Dashboard, navigate to SettingsDiscussion → scroll down to ‘Avatars‘ and you will see the Default Avatar section.

This section has a list of Gravatars that can be used as an alternative for the ‘mystery man’ avatar.

Now let’s choose a picture other than the default ‘mystery man’. As an example, I’m choosing the ‘Gravatar Logo’.

Hit the ‘Save Changes’ button and you will see the new gravatar for users who does not have a custom gravatar.

Now let’s see how to add a custom image to this list of available avatars.

Adding a Custom Image as the Gravatar

Step one is to create your own avatar, the dimensions should be 250×250 pixels. 

The second step is to upload this picture to the WordPress media library.

Go to Media→ Add New → Browse and upload the image. 

Once the image is uploaded, click on the ‘Edit’ link, it will take you to the Edit Media page, where you can copy the URL for the image. Copy it and save it somewhere.

Now we have to add a snippet of code and to do that you have to go to the functions.php file of your theme.

Click Appearance → Editor -> Open Theme functions (functions.php) file

Copy the code below and paste into the functions.php file and replace the ‘YOURAVATARURL’ with the URL of your custom made gravatar. Update the file.

add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar = 'YOURAVATARURL';
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;
}

Now let’s go see whether this image is showing in the list of available avatars or not.

Settings -> Discussion -> Avatar -> Default Avatar

change the default Gravatar in WordPress

The new gravatar is now showing in the list.

Hope this post made a good tutorial on how to change the default gravatar in WordPress.

Please consider sharing 💕

Leave a Comment