How to replace default Gravatar on WordPress

What is default Gravatar on WordPress? WordPress default Gravatar is a grey icon that is seen beside the name of the blogger who publishes the article or a commentator who leaves a comment. This is found in the comment section of the blog post. Default gravatar on WordPress also known as “mystery man”.

In this article, we will discuss what is a Gravatar, why you should use it the right way, and our main topic how to replace default Gravatar with your own image.

What is a Gravatar?

Gravatar stands for globally recognized avatar. Millions of people and websites use Gravatar. So it is globally recognized. Most popular applications like WordPress have built-in support for Gravatar. When a user leaves a comment with his email on a site that supports Gravatar, the site pulls globally recognized avatar from  Gravatar servers. Then that picture is shown next to the comment. This is a way of showing each commentator’s own identity throughout the world wide web.

default Gravatar on WordPress

Why should you add a Gravatar?

Gravatar is more likely branding yourself. It is a way of getting identified on the world wide web.This is especially important if you are a blogger.  Using Gravatar will build your brand on the Internet gradually.

Now you may think how this branding will take place? It can happen in the following way: suppose you read a blog and leave a comment there. You do the same thing on numerous sites. When other blog readers see your image with comments on a wide range of websites, they may have an interest in your site and visit the site. Publishers easily identify loyal users by their Gravatar. In addition, Gravatar makes your comment stand out among others.

Replace default Gravatar on WordPress with your own image

First, you need to a create an image that you want to use as the default Gravatar. The image resolution should be 250x 250 pixels. Then upload the image to your WordPress site.

After uploading the image go to the media library of your site and copy the URL of the image that you just have uploaded and paste it into a notepad file.

Add the following code to your theme’s functions.php file:

add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar = 'http://example.com/wp-content/uploads/2017/01/wpb-default-gravatar.png';
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;
}
But you must replace $myavatar variable value with the image URL that you have copied earlier. So your final piece of code will be like this:
add_filter( ‘avatar_defaults’, ‘wpb_new_gravatar’ );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar = ‘http://tareqseo.com/wp-content/uploads/2018/03/resize-image.jpg’;
$avatar_defaults[$myavatar] = “Default Gravatar”;
return $avatar_defaults;
}
Now go to settings-discussion page and you will notice your custom default avatar added to default avatar choices.
Select your custom default Gravatar image and click on save change button. Default Gravatar on WordPress will replace with your own image.
If the above article is helpful to you, please drop a comment below.

 

Leave a Reply

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