@gwc_wd
This issue drives me mad. I find totally outrageous that there is no simple built in function to turn global gravatar off. Not only is the privacy concern issue, it also slows down my jquery calls that are waiting until the whole page loads in. I have no idea who cares to have global icon and to give unknowingly, without their consent their email address away.
The above mention plugin doesn’t solve the problem as calls to gravatar.com are not stopped. It is just sending requests with generic dummy email address.
Another plugin out there that is available is called “add local avatar” but this is still no good as it uses only local avatar if they were uploaded. If not, it still calls gravatar.com for the rest of them. Even for dummy “mystery” man. How stupid is that.
All I really want is LOCAL AVATARS ONLY. No calls to external websites (gravatar.com, twitter.com) at all. Maybe the only solution is to write one.
Still no luck here?
Exactly looking for the same thing. Add Local Avatar plugin is used, but i’d really like to disable ALL requests to gravatar.com or any other service.
Has anyone found a way to remove gravatar.com from wordpress?
There’s an option in settings > discussions at the bottom to turn Gravatars off. Not sure if this completely disables them but, I’m having trouble loading 2 of my sites right now waiting for Gravatar images to load, but my other with it disabled loads with no issues.
Thank you, but this will disable all avatars, not just Gravatars.
Well, I think that you just need to override the function get-avatar().
To do this you put the following code in functions.php
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);
};
That lot will break the gravitar and avitar retrieval I believe. You will need to write a little bit of code (put your new function here) which retrieves the avatar but not the gravatar. I don’t use avatars or gravatars so I can’t be bothered to work out that code 🙂
function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {
$default = get_stylesheet_directory_uri() .'/images/avatar.png';
if( $image && strpos( $image, "gravatar.com" ) ){
return '<img src="' . $default . '" alt="avatar" class="avatar" ' . $html_width . $html_height . ' />';
} else {
return $image;
}
}
add_filter('bp_core_fetch_avatar', 'bp_remove_gravatar', 1, 9 );
function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {
$default = get_stylesheet_directory_uri() .'/images/avatar.png';
return "<img alt='{$alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
}
add_filter('get_avatar', 'remove_gravatar', 1, 5);
function bp_remove_signup_gravatar ($image) {
$default = get_stylesheet_directory_uri() .'/images/avatar.png';
if( $image && strpos( $image, "gravatar.com" ) ){
return '<img src="' . $default . '" alt="avatar" class="avatar" width="60" height="60" />';
} else {
return $image;
}
}
add_filter('bp_get_signup_avatar', 'bp_remove_signup_gravatar', 1, 1 );
The image that I am referencing doesn’t have to be a PNG. The size is 150×150. You may have to adjust the file name and/or path to your liking. This speeds up your site very much.