Gravatar on WordPress. What it is and How To change it?

Did you know that Gravatar can be used for online branding. In this article we will be introducing you to Gravatar and then we will show you how to change default Gravatar on WordPress.

Gravatar on WordPress. What it is and How To change it?

What is Gravatar on WordPress?

Gravatar stands for Globally Recognized Avatars. Gravatar on WordPress is specific type of avatar which will automatically appear next to your name whenever you comment in any WordPress site. Once registered with Gravatar, all your profile information along with Gravatar image is saved with your email address. WordPress has built in automatic support for Gravatar and automatically displays avatar next to username when someone write posts or leave comments. By default WordPress uses the Gravatar called Mystery Man. Here is a look at WordPress comment with default Gravatar.

comment- Gravatar on WordPress

If you are a blogger or common user, then you can use to build your online profile. The image of your account on Gravatar will be associated  with your Email address. This will help you in branding too.

Advantages of using Gravatar on WordPress

Using Gravatar has not only become the modern tradition in websites but it also come with tons of advantages both for site administrators and users.

 For administrators:
  • No need to install additional plugin for Gravatar.
  • Administrators do not need to manage various user accounts just for the purpose of getting Gravatar.
For users:  
  • Users won’t need of signing up every WordPress site to get Gravatar .
  • Easy to maintain and update Gravatar image. Just by updating a single image in the Gravatar account, your image in every site where you had commented will be updated.

Changing the Default Gravatar in WordPress site

To use Gravatar is extremely simple. Follow these steps.

  1. First log in to your WordPress as Admin.
  2. Go to Settings > Discussions and scroll down to avatar section
  3. In the discussion settings page scroll down to Avatars There are few customization that you can make in the avatar section.
    • Avatar Display: You can choose to hide or show your avatar.
    • Maximum Rating: Next you can give a maximum rating value which users can give for your Gravatar image based on Gravatar rating system.
    • Default Avatar: The last customization option called Default Avatar allows you to select the image that you want to display when the commenter does not have the Gravatar image.

Gravatar on WordPress

Change the default avatar any you like and save the changes.

That’s it now for every comment without the Gravatar will in your site will have the default comment that you have selected.

For Developers on Using Your Own Gravatar Image

Another great thing about Gravatar feature is that you can set your own default Gravatar image. You can use this opportunity to use your own unique Gravatar image which can represent your brand. Here is a simple guide how to set your own Gravatar on WordPress.

Start by uploading an image that you want to use as Gravatar. The image must be square with equal length and width. To upload image login to you WordPress dashboard and navigate to Media » Add New.  Upload your custom Gravatar image.

Gravatar on WordPress

For latter use you will need the URL of the image you just uploaded. To find the URL of the image you can click the edit button next to the Image or go to Media > Library and select your image. This will show you the detail of your image along with URL.

Also Read:   How to Check Which WordPress Version You are Using

Now open your themes functions.php file and paste the following code. The code simply adds filter to the hook called avatar_defaults.

add_filter( 'avatar_defaults', 'new_default_avatar' );

function new_default_avatar ( $avatar_defaults ) {
		/*Set the URL where the image file for your avatar is located */
		$new_avatar_url = get_bloginfo( 'template_directory' ) . '/images/new_default_avatar.png';
		/*Set the text that will appear to the right of your avatar in Settings>>Discussion */
		$avatar_defaults[$new_avatar_url] = 'Your New Default Avatar';
		return $avatar_defaults;

Replace the above URL of $new_avatar_url with the URL of your Gravatar image that you have uploaded. You can also upload the image in your themes files and use the path to the image here. Now when you visit Settings>Discussions you can find the new Gravatar image among the other choices.

Select your custom Gravatar for default Gravatar and save the changes. Here is what the new comment looks like.

Customization of Gravatar

Here are few more additional Gravatar customization features for developers that you can use. You can use wp_list_comments which can control the size of the Gravatar attached to the comments. The default size of Gravatar is 32px x 32px. If you want to change the size of the Gravatar to 50px then here is the code.

<?php wp_list_comments( array( 'avatar_size' => '50' ) ); ?>

You can also use the get_avatar  argument to change the default Gravatar to 50px.

<?php echo get_avatar( '', 50 ); ?>


That’s all. We hope the article was helpful in changing the default Gravatar on WordPress. For more help on managing the comments read our other articles on

The following two tabs change content below.

Kantiman Bajracharya

Kantiman Bajracharya is a freelance web developer. He is a computer geek who has a Bachelor’s degree in Computer Engineering. He has earned lots of satisfied customers while working for numerous successful projects. He is also a WordPress theme creator and web article writer. On free time he likes reading philosophy books, traveling and playing chess.

Share This Post