How to Change the Default Gravatar on WordPress

If the visitor does not have a gravator, WordPress will display the same gray ‘mystery person’ by default. By replacing this stock image with an image of your choice, you can brand your comments section and make it stand out.

What is Default Gravatar ?

Gravatar is WordPress’ default avatar system, used to connect WordPress users (and commenters) with unique email addresses. Once a Gravatar account is set up, the same avatar image will be displayed next to the user’s comments on any WordPress site.

When you install WordPress, you get a series of default Gravatar images, including a placeholder image that displays when a user doesn’t choose their own avatar.

Default Gravator Image

If you wish to change the default avatar, in the WordPress admin dashboard, head to Settings > Discussion.

WordPress Discussion Page

However, if you wish to select your own design, you should first create a design / Image in 250 x 250 pixel image. Once created, navigate to Media > Add New and upload the image to your site.

WordPress Media Page

Once the image has been uploaded, select it and then copy and paste its URL into a text editor like Notepad

You’ll now need to edit your WordPress functions.php file, which you can do using cPanel File Manager or by Theme file editor in the WordPress dashboard.

In this blog, I’ll show you how we can edit the function.php file in the WordPress dashboard itself.

Go to Appearance > Theme File Editor > function.php

Copy and paste the following code into your functions.php file. Change the URL in $myavatar to the URL you pasted into the text editor earlier.

 * Change default gravatar.

add_filter( 'avatar_defaults', 'md_new_gravatar' );
function md_new_gravatar ($avatar_defaults) {
$myavatar = '';  //Your Image Url
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;

Save the file and reload the Settings > Discussion page in your WordPress admin dashboard. You’ll notice that your new default Gravatar image is now available for selection

Select the new Gravator and click Save Changes.

Now if you visit your website you’ll see then new default gravatar image live.

I hope this article helped you learn how to change the default gravatar on WordPress. If you have any doubts or problem with the code, comment below to find the solutions. Also share this blog if you find this useful.

Want to build professional website for your business, Get a free quote here

Click here to get Premium Plugins and Themes at rs.199. Get 20% Off on your first order “WELCOME20”

Related Posts

Write a comment

Recent Posts



Thank you for submitting. We’ll get back to you shortly