No need to hack core. The function you’re looking at, get_avatar(), provides two options for changing what displays for the avatars.
1. get_option('show_avatars') at the start. Turn this option off to disable all avatars. No Gravatar images will be outputted.
2. apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt); at the end. This allows you to override the generated HTML with anything you want. No actual calls are made to gravatar in the get_avatar() function. Instead, the calls are made when a gravatar URL is outputted in HTML. This filter allows you to change that HTML before it’s put on the page.
You can find examples of using that filter to override avatar behavior here and here.
Turning off the avatars didn’t help. I still get read 1.gravatars.com in the progress bar. I removed a div from two of the page templates to see if that helped but it didn’t either.
add_filter('get_avatar', 'get_no_gravatar', 1, 2);
function get_no_gravatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
// put your new function in here
$avatar = "<img alt='image_alt' src='#' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
};
From another post, I put this in theme functions and it worked. The page no longer hangs on gravatar.com
Looks good, but you might want just return $avatar. I would think running apply_filters('get_avatar') inside a function that’s applied to that hook would cause an infinite loop.