A Complete Guide to Changing the Default Gravatar in WordPress

A Complete Guide to Changing the Default Gravatar in WordPress

Many people prefer to change their default Gravatar to their own liking. This personalize the content section and make it look branded. In this article, learn how you can change the default Gravatar in WordPress to your own default image.

Why Change Your Default Gravatar?

Gravatar allows to display icons as your profile image on websites created using WordPress. The avatars are created by a company called Automatic, which was founded by WordPress co-founder Matt Mullenweg.

By default, your Avatar is always a man icon. You can confirm this by commenting on a WordPress post and then looking at the image. If you haven’t made any changes, it will be a humanoid-like icon. This icon is also known as “Mystery Man” image.

If you don’t want that mystery man image, you can change it to your own branded image.

Changing Default Gravatar in WordPress

Here are the steps involved in the process:

  • Log in to your WordPress dashboard
  • Visit Settings >> Discussion page
  • Scroll down till you see the Avatar section. This is where you can change your Avatar image
  • You’ll find options you can change about your Avatar
  • Notice how in the “Default Avatar” option, the radio button is set on “Mystery Person.” That’s why WordPress displays this image. There are other options as well you can select and can even leave it blank
  • To change the avatar to an image of your preference, you need to upload it
  • The image should be square with a dimension like 250 X 250 pixels
  • Now, navigate into Media >> Add New and upload the image you want to use
  • Once the image is uploaded, click on the “Edit” option next to the image
  • It will open a panel where you can find the “File URL”. Copy this URL and paste to the clipboard
  • Now open the functions.php file. You can also use a plugin for this purpose
  • Inside the file, paste the following code:
    Code:
    add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
    [/LIST]
    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;
    }
  • Replace the URL in $myavatar with the code you pasted to the clipboard
  • Now again navigate into Settings >>Discussion page
  • You’ll notice that a custom avatar is added in the Default Avatar option. Select it as your default option
  • Save the changes and exit
Now head over to the comments section. You’ll find your avatar image has changed. So that’s how you change the default Gravatar in WordPress.

You can do the same for other users on your WordPress website.
Author
kumkumsharma
Views
2,429
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top