How to Set Your Own Default Gravatar in WordPress

You have seen it in most WordPress blogs: If the commenter’s profile does not come with its own gravatar, the Mystery Man icon is shown instead. Kind of ugly, isn’t it?

What if you can add your own custom gravatar and make it show up in the comments, won’t that be a good way to beautify your blog as well as brand yourself?

Luckily, in WordPress, this can be easily done. You might need to dabble into some coding, but I assure you that it is just a matter of copy/paste the code into the correct files and some minor editing. Follow along and we will guide you through.

1. Create your own custom gravatar, preferably of the size 64 x 64px.

2. Using a FTP program, log on to your server. Navigate to the active themes folder (wp-content -> Themes -> your themes folder). Check if a “images” folder exists. If not, create it.

3. Upload your custom gravatar to the images folder. To check if it is working, on the browser, your custom gravatar should be accessible via the URL:

http://your-site-url.com/wp-content/themes/your-active-theme/images/custom-gravatar-filename.jpg*

* Change the “your-site-url” to your domain name. Change “your-active-theme” to the name of the theme that you are currently using. Change “custom-gravatar-filename.jpg” to the name of your custom gravatar file.

4. Next, download the functions.php file to your desktop and open it with a text editor. Add the following code to the end of the file.

function add_custom_gravatar ($avatar) {
$custom_avatar = get_bloginfo('template_directory') . '/images/name-of-your-custom-gravatar.jpg';
$avatar[$custom_avatar] = "Gravatar name to be shown in the WordPress settings"; //change this name to your preferences
return $avatar;
}
add_filter( 'avatar_defaults', 'add_custom_gravatar' );

5. Save and close the functions.php file. Upload and overwrite the file in the server.

6. Log into your WordPress dashboard as the administrator and go to Settings -> Discussion. You should see your custom gravatar ready for selection.

gravatar-added

7. Select it and click Save changes.

That’s it. Your custom gravatar will be used whenever a commenter’s profile does not come with a gravatar.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Damien Oh Avatar

Read next

Content and cloud networks now account for three-quarters of used international bandwidth, while Google, Meta, Microsoft and Amazon own, co-own or buy capacity on a growing share of the 600-plus submarine cable systems carrying over 99 per cent of data between countries, a private map hidden below the wireless internet
Wi-Fi doesn’t actually slow down when a café gets crowded — the signal is fine, but every device has to wait its turn to speak on the same frequency, and the polite queuing is what you feel as lag
In 1988, a 23-year-old Cornell graduate student named Robert Morris released a self-replicating program to measure the size of the internet — within hours it had crashed roughly 6,000 of the 60,000 machines then online, and computer security became a field
In July 2026, Psy’s Gangnam Style passed six billion YouTube views, fourteen years after its horse-riding dance became the platform’s first billion-view video and long after engineers had replaced a counter designed to stop at 2,147,483,647
Suzanne Simard sealed paper birch and Douglas fir seedlings inside plastic bags, fed them carbon-14 and carbon-13 dioxide, and nine days later found carbon had crossed between species through fungal threads in the British Columbia soil beneath her boots
A species of jellyfish called Turritopsis dohrnii can revert its adult cells back to a juvenile polyp stage when injured or starving, effectively restarting its life cycle, and biologists have so far failed to identify any natural limit to how many times it can do this.
A Japanese man named Jiroemon Kimura, who lived to 116, was born in 1897 when Queen Victoria still ruled and died in 2013, meaning a single human life personally overlapped with the invention of the airplane, the atomic bomb, the internet, and Instagram
The Hollywood sign originally read HOLLYWOODLAND when it was built in 1923 as a real estate advertisement for a housing development, and it was only meant to stand for 18 months, but nobody ever got around to taking it down and the city eventually adopted it as a landmark