Add Custom Gravatar Image In WordPress Without Plugin

WordPress uses the default Gravatar image if the user does not have an own image to show as a profile photo. Default Gravatar image is a “Mystery Person”. There is more you can change. So, in this trick, we will learn about Custom Gravatar Image In WordPress.

But if the user wants to make own image as a default gravatar. Then you have to do some tricky code in the function file. Of course, you can do it with some plugins. But in this tutorial, I’ll let you know how you can add a custom gravatar image in WordPress without any plugin. It is very simple. You just need to add some lines of code on the function.php file. and you are done.

Firstly, you need to upload your image to the library and copy the file path. We will use this path in the below code.

Let’s see the example below:

Save it and you can check it under Settings » Discussion page. You will see the default gravatar changed with your custom gravatar.

About the Author: Aman Mehra

Hey! I'm Aman Mehra and I'm a full-stack developer and have 5+ years of experience. I love coding and help to people with this blog.

1 Comment

Leave a Reply

Your email address will not be published.