How to change default Gravatar on WordPress (Easy Tutorial)

How to change default Gravatar on WordPress (Easy Tutorial)

Do you want to change the default Gravatar on your WordPress site?

If a commenter doesn’t have a Gravatar, then WordPress will show the same grey ‘mystery person’ by default. By replacing this stock picture with an image of your choice, you can personalize your comment section to your brand and make it stand out.

In this article, we will show you how to change the default Gravatar on WordPress.

What Is a Default Gravatar and Why Change it?

Gravatar stands for Globally Recognized Avatar. It’s a web service that allows people to create a profile and associate avatar images with their email address.

All WordPress sites have built-in support for Gravatars and will automatically show the user’s avatar when they write posts on a multi-author WordPress blog or leave comments.

If a user doesn’t have a Gravatar, then WordPress will show a default Gravatar instead. For most WordPress websites, this is a grey mystery person.

You can change this default Gravatar to any other picture of your choosing. For example, you might use an image that represents your company, such as your website logo. This can help reinforce your branding.

Having said that, let’s see how you can change the default Gravatar image on your WordPress website or blog. Simply use the quick links to jump straight to the method you want to use:

Method 1: Choose a Different Built-in WordPress Gravatar (Quick and Easy)

WordPress comes with a few different default Gravatars that you can use. Using the defaults is the quickest way to change the mystery person Gravatar, although these images won’t be unique to your WordPress website or brand.

To look at the different default Gravatars, you need to go to Settings » Discussion from the WordPress admin area.

Under ‘Default Avatar,’ you will see all the different built-in avatars that WordPress can use when there’s no Gravatar linked to the person’s email address.

Out of the box, WordPress uses the mystery person as its default, but you can use any other image in this section.

Simply click on the radio button next to the image you want to use on your WordPress site.

Then, scroll to the bottom of the screen and click on ‘Save Changes.’

Method 2: Insert a Code Snippet to Use a Custom Gravatar (Code Method)

You can also upload a custom gravatar using code. You may prefer this method if you simply want to add a new image to the gravatar list on the WordPress Discussion page.

You need to have an image that you want to use as a gravatar.

After that, you can upload the image to your WordPress site by going to Media » Add New. Here, you can either choose an image from the WordPress media library or upload a new file from your computer.

Now that you’ve chosen an image, go ahead and click on the ‘Edit’ link next to it.

WordPress will now open the file for editing. On this screen, scroll to the ‘File URL’ section.

Make a note of this URL, as you will need it in the next step.

At this stage, you need to add some code to your WordPress site. Often, tutorials will ask you to add custom snippets to your theme’s functions.php file.

However, we don’t recommend this because even a small mistake in your code can cause common WordPress errors or completely break your website.

Here is the code snippet that you can put in your theme’s functions.php file.

				
					<?php
add_filter( 'avatar_defaults', 'my_new_gravatar' );
 
function my_new_gravatar($avatar_defaults) {
    // Replace the URL below with your own Gravatar image URL
    $myavatar = 'http://example.com/wp-content/uploads/2017/01/my-default-gravatar.png';
 
    $avatar_defaults[$myavatar] = "Default Gravatar";
    return $avatar_defaults;
}
?>
				
			

Don’t forget to replace the URL with a link to the image you want to use as the default WordPress Gravatar.

To start using this Gravatar, go to the Settings » Discussion page. In the ‘Default Avatar’ section, select the new ‘Default Gravatar’ option.

After that, make sure you click on ‘Save Changes’ to store your settings.

Now, if you visit your website, you’ll see the new default Gravatar image live.

That’s it! To learn more about gravatars in WordPress.