How to Display Author’s Gravatar on their Posts in WordPress


In many WordPress multi-author blogs, you may see a gravatar image of the author near the title of the post. It helps readers easily distinguish the author of the post. Although TheWPGuides is a single-author blog, I also show the author images in single posts, archives, and category posts. By default, most of the themes show the author bio below the post content but not in the post loops and home page. WordPress has a profile option where users can set their profile photos. But most WordPress themes support Gravatar. Gravatar stands for Globally Recognised avatars. It is a web service that lets users upload an online avatar. It is associated with the email address and many services including WordPress use it to show photos using gravatar. You need to create an account on and set a default avatar.

Most of the themes and frameworks now support this and show the author’s gravatar image icon near the title of the post. But what if your theme does not support this feature? I saw many bloggers searching for plugins to add this kind of author photo feature. But, you do not need any plugin to add a gravatar photo. You can do this without using any kind of plugin.

Best Managed WordPress Hosting

WPEngine is the best and most secure managed hosting provider

Just put this code where you want to show the author’s gravatar photo.

<?php echo get_avatar( get_the_author_email(), '48' ); ?>

This code is simple to understand. The get_the_author_email() function fetches the email of the author and get_avatar() function puts the gravatar image of the author. Number 48 is the size of the image in pixels. It will show the avatar in 48 x 48 pixels size. You can change it according to the space available in your design format.

If you are adding this code, be sure to create a gravatar account and then upload your picture before using this. Gravatar is known as the globally recognized avatar. Not just WordPress but many services use this. If you have not added a photo to gravatar, it will show the default gravatar photo in place of your photo. So create an account there and upload a photo of yourself. Not just on your website, but this gravatar image will also be shown in blogs where you comment or write guest articles.

Also read: Vs

Final Words

Now you know how to put gravatar images in post loops. Try this code to add a gravatar image at any place in WordPress. If you do not have knowledge of coding, you can always hire me to work for you. I can help you with little cost or for free.

If you have anything to ask, you can comment below.

Tags: |

Deepanker Verma is an experienced WordPress developer who has been working on WordPress for more than 12 years. On TheWPGuides, he writes about WordPress, WordPress development, and WordPress plugins.

Similar Articles


Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

© 2022 The WP Guides Developed By Deepanker