How to Add Custom Gravatar Image

You can define some prebuilt Gravatar image from Settings>Discussion>Default Avatar option. But it doesn’t allow you to upload your custom gravatar image. In this solution doc, I am going to show you how to upload your own images as custom gravatar. 

First upload your custom gravatar image inside your media. Then expand the gravatar image so that you can copy the image source URL when it needs. 

Now open a text or code editor and copy paste the following code. It’s time to copy your gravatar image source URL from your media. Replace my demo image URL inside the code. And copy the full code again. 

				
					// Add Custom Default Gravatar Image
add_filter('avatar_defaults', 'jltwp_adminify_add_custom_gravatar');
function jltwp_adminify_add_custom_gravatar($avatar_defaults)
{
    $avatar_defaults['Avatar Image URL here'] = 'Avatar Name here';
    return $avatar_defaults;
}
				
			

Login to your Cpanel or FTP, edit your active theme’s function.php file and paste the full code inside this function.php file.

If you think editing code is a hassle for you, you can easily add custom gravatar using WP Adminify plugin. After WP Adminify activation, navigate to the plugin settings page.

You will see the “Tweaks >Comments” option. Inside comments option, you will see “Custom Avatar” panel. Just enable it and upload your custom Gravatar and define it’s name. 

Custom Gravatar for WordPress website
Was this article helpful?

© 2021 - Adminify | All rights reserved

WP Adminfy accepted payment methods