How to Add Custom Gravatar for Comments in Genesis Theme

Gravatar has become a part of many websites and blogs. In fact, the use of Gravatar by internet users is ever raising.

In WordPress, the most prominent place where the Gravatars appear publicly is when a user or visitor comments in your blog’s commenting section.

That’s the reason why WordPress comes with built-in support for the Gravatar.

That being said, not every commentator of you website will have a Gravatar. When there is no Gravatar, the WordPress will display the “Mystery Man” image to compensate the lack of Gravatar image.

Of course, you can always customize the default avatar between Gravatar Logo, Identicon, Wavatar, MonsterID, Retro, and Blank (none image). Or, you can even add their own first letter in their names as their avatar.

Additionally, you can also set your own custom Gravatar so that the image blends with your side design or content. So, here is how you can add custom Gravatar for comments in Genesis.

Add Custom Gravatar for Comments in Genesis

To add custom Gravatar for comments in Genesis, we need to add a simple code snippet.

Before that, make sure that you have an image something like your website logo with the dimensions 48 X 48 pixels and name it gravatar.png. In my case,

I’m using the Bloggersignal logo as the site’s custom comment avatar.

Now, we need to upload the image. To do that, fire up your FTP client, navigate to Genesis child theme folder. Here, open the folder “Images” and upload the image to that folder.

Add custom Gravatar for comments in Genesis - Upload custom Gravatar image.

After uploading the image, navigate to Genesis child theme folder and open the file functions.php.

Add custom Gravatar for comments in Genesis - Open functions file.

Once the file has been opened, copy and paste the below code in the file. Once you are done adding the code, save and reupload the file.

If you’ve saved your custom Gravatar image with a name other than gravatar.png, then change the image file name accordingly in the below code.

// Create a custom Gravatar
add_filter( 'avatar_defaults', 'sp_custom_gravatar' );
function sp_custom_gravatar ($avatar) {
	$custom_avatar = get_stylesheet_directory_uri() . '/images/gravatar.png';
	$avatar[$custom_avatar] = "Custom Gravatar";
	return $avatar;

Now, we need to enable the added custom Gravatar in WordPress dashboard. To do that, open the Discussion settings page by navigating to “Settings” and then “Discussion.”

Add custom Gravatar for comments in Genesis - Open Discussion settings.

Once you are in the Discussion settings page, scroll down and select the radio button “Custom Gravatar” and click on the “Save changes” button to save the changes.

Note: Sometimes you may not see the “Custom Gravatar” option. Try clearing the cache.

Add custom Gravatar for comments in Genesis - Select custom Gravatar.

That’s all there is to do. From this point forward, your own custom Gravatar will appear whenever the commentator of your site has no Gravatar.

Add custom Gravatar for comments in Genesis - Custom Gravatar in action.

Alternatively, you can also set the first letter in the users names as their Gravatar. This approach makes the Gravatars more dynamic and unique.

As a side note, removing website URL field in the comments form reduces the comment spam.

Hopefully that helps and do comment below sharing your thoughts and experiences about using the above method to add custom Gravatar for comments in Genesis.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.