Family Encyclopedia >> Electronics

How to Customize the Default Gravatar in WordPress: Step-by-Step Guide

Want to brand your WordPress site's comments section? Replacing the default Gravatar with your own custom image is a simple way to enhance your site's professional look. As experienced WordPress developers, we'll walk you through the process step by step.

How to Customize the Default Gravatar in WordPress: Step-by-Step Guide

What Is the Default Gravatar and Why Replace It?

Gravatar, developed by Automattic (co-founded by WordPress creator Matt Mullenweg), links avatar images to email addresses. These avatars appear across WordPress sites on comments and posts. For a deeper dive, see our guide on What is Gravatar and why you should start using it right away.

WordPress natively supports Gravatars, displaying them automatically. But if a user lacks a Gravatar, it defaults to the 'mystery man' silhouette:

How to Customize the Default Gravatar in WordPress: Step-by-Step Guide

Swap this for your branded image to maintain consistency and trust on your site. Let's get started.

Switching the Built-In Default Gravatar

Head to Settings » Discussion and scroll to the Avatars section to adjust Gravatar settings.

How to Customize the Default Gravatar in WordPress: Step-by-Step Guide

Choose from preset defaults like 'mystery person' (standard), blank, or generated patterns based on the commenter's name or email. Click Save Changes to apply.

Adding Your Custom Default Gravatar Image

For full control, upload your own image—ideally square at 250 × 250 pixels.

Go to Media » Add New to upload it.

How to Customize the Default Gravatar in WordPress: Step-by-Step Guide

Click Edit on the image, copy its URL, and note it down.

How to Customize the Default Gravatar in WordPress: Step-by-Step Guide

Now, add this code to your theme's functions.php file or a site-specific plugin (see our guide on how to copy-paste code in WordPress safely):

function wpb_new_gravatar( $avatar_defaults ) {
    $myavatar = 'https://example.com/wp-content/uploads/2017/01/wpb-default-gravatar.png';
    $avatar_defaults[$myavatar] = 'Custom Gravatar';
    return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'wpb_new_gravatar' );

Replace the $myavatar URL with your image's link. Save, then revisit Settings » Discussion—your custom option now appears.

How to Customize the Default Gravatar in WordPress: Step-by-Step Guide

Select it and save. Users without Gravatars will now show your image:

How to Customize the Default Gravatar in WordPress: Step-by-Step Guide

This tweak has helped countless sites we've optimized look more cohesive. Also check our guide on setting up custom avatars for users in WordPress.

If this was useful, subscribe to our WordPress YouTube Channel for video tutorials. Follow us on Twitter and Facebook for more tips.