SDAC Blog

Read our latest blog posts, learn something new, find answers, and stay up to date.

HOWTO: Set Custom Default Gravatar in WordPress

If you ever wanted to set your own custom avatar as the default for Gravatar on your WordPress site – here is a simple way to do it. All you need to do is make your custom avatar accessible somewhere on the web by either uploading it to your site or another site, then add this code to your functions.php file in your active theme:

add_filter( 'avatar_defaults', 'sdac_custom_gravatar' );
function sdac_custom_gravatar ( $avatar_defaults ) {
     $custom_gravatar = 'http://media.sandboxdev.com/wp-content/themes/SDACINC2012/images/logo-small.png';
     $avatar_defaults[$custom_gravatar] = "SDAC Inc. Logo";
     return $avatar_defaults;
}

You will then see it in the list of gravatars in Settings > Discussion on your site as well.

This is quick and painless way to help brand your site.