• By :  Piyush Rishi Singh
  • Last Updated :  December 2, 2022
  • Words Count :  629 Words
  • Est. Reading Time :  5 mins

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

What is Default Gravatar and Why Change it?

Gravatar is a web service created and run by WordPress co-founder Matt Mullenweg’s company called Automattic. It allows anyone to create a profile and associate avatar images to their email addresses.

This avatar image is then displayed on all WordPress blogs where users leave comments or write blog posts.

All WordPress sites come with built-in support for gravatars and automatically show users’ avatars when they write posts or leave comments.

However, if a user doesn’t have a gravatar image, then WordPress automatically shows the default gravatar image. The default option is to show an image called mystery man. It looks like this:

Default mystery person gravatar in WordPress

If you don’t want to use the mystery man as default image, then you can change it to your own branded image.

Having said that, let’s see how you can change the default gravatar image on your WordPress site, so you can use a custom default gravatar image.

Changing Default Gravatar Image in WordPress

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.

Gravatar settings in WordPress

You will notice that there are a few choices available under the default avatar option. These avatars are used when a user does not have a gravatar associated with their email address.

Out of the box WordPress uses the mystery person icon as the default gravatar. You can change that to blank or gravatar logo.

There are few other options available as well. These are automatically generated images in different designs. These images use comment author’s name or email address to mathematically generate a unique gravatar image.

Don’t forget to click on the save changes button after changing your default gravatar.

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.

Upload and edit custom default gravatar image

After the image is uploaded, you need to click on the Edit link next to the image.

WordPress will now open your image for editing. You need to just copy the image file URL and paste it in a plain text editor like Notepad.

Copy file URL

Now you need to add some code to your WordPress site.

Add the following code to your theme’s functions.php  file :

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;
}

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.

Custom default gravatar image

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.

Custom default avatar image in WordPress

 

We hope this article helped you learn how to change the default gravatar on WordPress.

If you liked this article, then please share & follow us on Facebook , Twitter , Linkedin

Share :
Piyush Rishi Singh

Piyush Rishi Singh

www.piyushrishisingh.com
(Founder & Business Head At Techzax Innovations Pvt. Ltd.)

A Digital Entrepreneur & Content Creator who loves simplifying tech.
Expertise: A Full Stack & highly skilled 10+ years experienced WordPress developer who specializes in complete custom tailored WordPress Websites development.

Table Of Contents