Archived topic
Replace Avatars
5 replies · Started by Florian on February 14, 2019
I've installed "WP User Avatar" where the user can upload an image locally.
If the user didn't upload an image, it still loads the Gravatar externally. I want to disable external Gravatars completely. As far as I understand, the plugin provides a method to get its local image. Is it possible to add this into the theme so whenever normal a Gravatar is displayed, it uses the plugins local image instead and never makes a connection to gravatar.com?
Hi there,
Doesn't the plugin replace the avatars with the local image by default?
Or are you wanting to use a default local image if the user doesn't have their own local image added?
Let me know :)
It looks like the plugin doesn't replace Gravatars in already existing comments, but I am also in contact with their support now.
Sounds good, hopefully they have an easy solution :)
Can you tell me what exactly this code does:
function remove_all_wp_avatars() {
return "";
}
add_filter( 'pre_get_avatar', 'remove_all_wp_avatars', 10, 3 );
It removed the Gravatars, but my local avatar uploads still work. This is exactly what I want but I am uncomfortable to use something I don't understand. I understand that this removes avatars by returning an empty string for, but why are the avatars uploaded locally over a plugin still working, even in the comments?
Hi there,
It's likely that filter fires before your local avatars are being added. I would need to see how the local avatars are being added to be 100% sure.
That filter doesn't look like it'll cause any issues :)