Disable Gravatars in WordPress

I have found this code for disable gravatar on email but it not work on 100% why? Because it replace online image but the image always open with gravatar domanin..

function __default_local_avatar()
{
    // this assumes default_avatar.png is in wp-content/themes/active-theme/images
    return get_bloginfo('template_directory') . '/images/default_avatar.png';
}
add_filter( 'pre_option_avatar_default', '__default_local_avatar' );

How to remove request from gravatar without delete avatar?

Related posts