How to Add Gravatars to WordPress Themes (Classic and Block)
Want to add Gravatars to your WordPress theme? Gravatars (globally recognised avatars) show each commenter’s picture next to their comment, which makes discussions feel more personal and helps regular readers stand out. WordPress has supported them out of the box since 2008, when we first added them to our QuickPress theme. Here’s how to add Gravatars to WordPress themes in 2026, for classic and block themes, plus default avatar and privacy options.
![]()
Quick answer: Go to Settings > Discussion, tick Show Avatars, choose a maximum rating and a default avatar. Most themes then show Gravatars automatically. In a classic theme without them, add get_avatar( $comment, 48 ) to your comment template or set avatar_size in wp_list_comments(). In a block theme, add the Avatar block inside the Comment Template block.
Table of Contents
1. Turn on avatars
In WordPress admin go to Settings > Discussion > Avatars and tick Show Avatars. Here you also set:
- Maximum rating: G (suitable for all audiences) hides avatars rated PG, R or X.
- Default avatar: what people without a Gravatar see (see step 4).
2. Add Gravatars to a classic theme
Most themes already call wp_list_comments(), which shows avatars at 32 px by default. Change the size in your child theme’s comments.php:
<?php wp_list_comments( array( 'avatar_size' => 48 ) ); ?>If your theme uses a custom comment callback, add this where the avatar should appear:
<?php echo get_avatar( $comment, 48 ); ?>Here’s more on how to change avatar size in WordPress comments.
3. Add Gravatars to a block theme
In Appearance > Editor, open the single post template, select the Comments block and its Comment Template, and insert an Avatar block. You can set size and rounded corners in the block settings, without code.
4. Choose a better default avatar
Not every commenter has a Gravatar. Instead of the grey Mystery Person, pick a generated avatar so each person gets a unique image:
- Identicon: geometric pattern
- Wavatar: friendly faces (our long-time favourite)
- MonsterID: cartoon monsters
- Retro: 8-bit pixel faces
- RoboHash: robots
5. Style the avatar with CSS
Avatars have the .avatar class. For round avatars floated left of each comment, add this in Appearance > Customize > Additional CSS:
.comment-list .avatar {
float: left;
margin: 0 12px 0 0;
border-radius: 50%;
}Privacy and speed
- Gravatar works from a hash of the commenter’s email address. Mention it in your privacy policy, as WordPress’s default policy text suggests.
- Each avatar is an image request to Gravatar’s servers. On posts with hundreds of comments, lazy load comments to keep pages fast.
- Prefer to host avatars yourself? Plugins such as Simple Local Avatars let users upload a profile picture instead.
Get your own Gravatar
Sign up free at Gravatar.com with the email you use to comment. Your picture then appears on millions of WordPress sites, including this one.
FAQ
Why are Gravatars not showing on my site?
Check Show Avatars is ticked, your theme outputs avatars, and that a caching or privacy plugin isn’t blocking gravatar.com.
How do I change my Gravatar?
Log in to Gravatar.com and upload a new image. Changes may take a little while to appear because of caching.
Can I disable Gravatars completely?
Yes. Untick Show Avatars in Settings > Discussion.







Was looking all over for an easier solution to adding these gravatars to our websites. Thanks a bunch!
thank you very much.. i’m in the middle of creating my own theme when i encounter the problem off adding the gravatar.
Amaze! I’ve been seeking bing all day because of this and i also lastly think it is right here!
By the way do you know how to add the code so that gravatars are also on Recent Comments? Where would this code have to be entered also in the comments.php? Thanks.
Hi! This code worked perfectly with the theme that we were currently using on WordPress. Now the theme and gravatars are simply controlled through the dashboard! We have been looking for this code everywhere on the net but to no avail, thank you so much for posting!
Instructions were clear and we had no problem replacing the original code even though we are not programmers.
Cheers,
Lord and Aksana
Looks simple, I hope it works!
We need to use the CSS expression to set the width of the above mentioned div tag and the screen.width of javascript also.
Thanks in advance;i haven’t yet implemented, but looks easy.
Had used this in my blog,works swiftly!thanks!
This is very cool feature
Thanks for that, just coding my blog at the moment. Handy bit of code :)
Wow! Didn’t think it was so easy :) I’ll just add that it looks nicer if you add it WITHIN the tag just after
<li class=”” id=”comment-“>
(although that may just be for the theme I’m using). Otherwise the image appeared after the comment, which didn’t look so great.
Anyway, your post is nice and clear! You’ve earned the google page 1 rank for this search that brought me here :D
Thanks a lot. I’m not quite sure what sites I can add gravatars to because in the main I deal with commercial sites. But worth experimenting with.
Thanks for the info. I wanted to update my site but wasn’t sure how to code the theme.
Thanks so much for this tut – my theme didn’t have gravatars enabled and I had no idea what code I needed to add them in – and it was so simple too!
thnx alot for the share. i never knew this feature for wordpress
One other comment though… why don’t you use gravatars on this site?!?
Wow, that was easy. Thanks! I’d been putting off implementing gravatars onto my site until I saw this quick tutorial :D