WordPress Function to Replace Default Gravatar with Custom Image

Replace Default Gravatar with Custom Image

All you’ll need to customize is the path to your default image.

function custom_gravatar($avatar_defaults) {
    $logo = get_bloginfo('template_directory') . '/images/icons/gravatar_logo.jpg'; //Change to whatever path you like.
    $avatar_defaults[$logo] = get_bloginfo('name');
    return $avatar_defaults;
}//END FUNCTION    
add_filter( 'avatar_defaults', 'custom_gravatar' );

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *