I have to agree with you. I had the hardest time trying to figure out why one of my pages was loading incredibly slow. After a lot of headbanging, it turns out that the plugin was calling wp_remote_head() an excessive amount of times.
Technically you can disable the request by checking off the “Disable Gravatar and only use local avatars” option, but that’s not a great option.
Here’s my solution:
Select anything but “WP User Avatar” as the default avatar(first it’s super ugly and then it breaks for users without an avatar)
Then open wp-content/plugins/wp-user-avatar/includes/class-wp-user-avatar-functions.php and scroll down to the line(mine is 192) that says
} elseif((bool) $wpua_disable_gravatar != 1 && $wpua_functions->wpua_has_gravatar($id_or_email)) {
and change it to this:
} elseif((bool) $wpua_disable_gravatar != 1 /*&& $wpua_functions->wpua_has_gravatar($id_or_email)*/) {
You’re all set – no more checking for avatars, making your page load not impacted by the ridiculous code design.
Hey Nikola,
Great solution!
I did something very similar, changing the wpua_has_gravatar function to always return true without checking with the server, which has the same effect as your fix.
Plugin version 1.9.13
File: wp-content/plugins/wp-user-avatar/includes/class-wp-user-avatar-functions.php
Line: 33
Before:
public function wpua_has_gravatar($id_or_email="", $has_gravatar=0, $user="", $email="") {
After
public function wpua_has_gravatar($id_or_email="", $has_gravatar=0, $user="", $email="") {
return true;
You guys seem to be very informed. What is your take on “Avatar Manager” or “Simple Local Avatars”? I can’t decide and I’m sure after seeing this post others feel the same. Any input would be much appreciated. Thanks!