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.

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:

Swap this for your branded image to maintain consistency and trust on your site. Let's get started.
Head to Settings » Discussion and scroll to the Avatars section to adjust Gravatar settings.

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.
For full control, upload your own image—ideally square at 250 × 250 pixels.
Go to Media » Add New to upload it.

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

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.

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

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.