Custom Author Image Without Gravatar To WordPress Without Plugin

If you want to add custom author image without gravatar to WordPress without plugin, this tutorial will show you exactly that. 

By default WordPress integrated with Gravatar service to show author images. The picture is associated with your email and whenever you register a new author on your blog, the image is pulled out.

There may be plugins which can help you to change that, but I try to keep as few plugins as much as I can because it just bloats the system and we want WordPress website to load fast. As you may now understand we don’t want to use Gravatar to show your author image, so here is what you can do. 

Add custom author image without Gravatar to WordPress without plugin.

First of all open WordPress dashboard => Media and upload your desired profile image. Image size 250×250 pixels (just my prefference).

Go to Appearance => Theme File Editor => functions.php and add the code below.

/* Add locally hosted avatar image without Gravatar service */
add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar = 'your_image_url';
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;
}
/* End of local avatar */

Copy image URL from uploaded profile picture and paste it instead of ‘your_image_url’

Click on Update and close it

Make sure you have checkmarked “Show Avatars” under Settings=> Discussion

show avatars wordpress settings

When you add the code the new option “Default Gravatar will appear” so set it up and save discussion settings. 

Note: If you competely disabled comments using plugin or code, then you will not be able to find Discussion setting. Enable comments just temporarily in order to set up author image.

Now open any of your blog posts and scroll down to the author box,- the new avatar image should be visible.

P.S. Make sure you’re using WordPress child theme because every time the theme is updated by the developer your files like functions.php will be overwritten and all settings lost.

YouTube video

Congrats you have just added custom author image without gravatar to WordPress without plugin. The image is hosted locally, you’ve saved one network request and skipped Gravatar registration process 🙂

About Mantas J

Blogger, marketer, coffee lover,- currently now developing several online projects. I know a thing or two about digital marketing :) Follow me on Twitter or YouTube.