How to Change the Default Gravatar on WordPress

Do you want to change the default Gravatar on your WordPress site? By adding your own default gravatar image, you can make your comments section branded. In this article, we will show you how to change the default gravatar in WordPress and replace it with your own custom default gravatar image.

What is Default Gravatar and Why Change it?

Gravatar is a web service created and run by WordPress co-founder Matt Mullenweg’s company called Automattic. It allows anyone to create a profile and associate avatar images to their email addresses.

This avatar image is then displayed on all WordPress blogs where users leave comments or write blog posts.

All WordPress sites come with built-in support for gravatars and automatically show users’ avatars when they write posts or leave comments.

However, if a user doesn’t have a gravatar image, then WordPress automatically shows the default gravatar image. The default option is to show an image called mystery man. It looks like
this:

If you don’t want to use the mystery man as default image, then you can change it to your own branded image.

Having said that, let’s see how you can change the default gravatar image on your WordPress site, so you can use a custom
default gravatar image.

Changing Default Gravatar Image in WordPress

First, you need to visit Settings » Discussion page and scroll down to Avatars section. This is where you can configure and change gravatar settings on your WordPress site.

You will notice that there are a few choices available under the default avatar option. These avatars are used when a user does not have a gravatar associated with their email address.

Out of the box WordPress uses the mystery person icon as the default gravatar. You can change that to blank or gravatar logo.

There are few other options available as well. These are automatically generated images in different designs. These images use comment author’s name or email address to mathematically generate a unique gravatar image.

Don’t forget to click on the save changes button after changing your default gravatar.

Using Custom Default Gravatar Image in WordPress

WordPress also allows you to use your own default gravatar images. Here is how you can easily add your own custom
default gravatar image in WordPress.

First you need to create an image that you want to use as the default gravatar. This image should be a square, like 250×250 pixels.

Next, you need to upload this image to your WordPress site. Head over to Media » Add New and upload your custom default gravatar image.

After the image is uploaded, you need to click on the Edit link next to the image.

WordPress will now open your image for
editing. You need to just copy the image file URL and paste it in a plain text editor like Notepad.

Now you need to add some code to your WordPress site.

Add the following code to your theme’s functions.php file or a site-specific plugin.

a d d _ f i l t e r ( ‘ a v a t a r _ d e f a u l t s ‘ , ‘ wp b _ n ew_ g r a v a t a r ‘ ) ; f u n c t i o n wp b _ n ew_ g r a v a t a r ( $ a v a t a r _ d e f a u l t s ) { $my a v a t a r = ‘ h t t p : / / e x amp l e . c om/wp – c o n t e n t / u p l o a d s / 2 0 1 7 / 0 1 / wp b – d e f a u l t – g r a v a t a r . p n g ‘ ; $ a v a t a r _ d e f a u l t s [ $my a v a t a r ] = ” D e f a u l t G r a v a t a r ” ; r e t u r n $ a v a t a r _ d e f a u l t s ; }

Don’t forget to replace $my a v a t a r value to the URL of the custom gravatar image you uploaded earlier.

You can now visit Settings » Discussion page and you will notice your custom
default avatar added to default avatar
choices.

Select your custom default avatar image, and then click on the save changes button.

WordPress will now use your image for users who don’t have their gravatar associated with their email addresses.

We hope this article helped you learn how to change the default gravatar on WordPress.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s