Closed pire closed 1 year ago
Looking at the format of Gravatar URLs, here's a URL for a populated avatar: http://2.gravatar.com/avatar/e70d4086e89c2e1e081870865be68485?s=64&d=mm&r=g
Here's a URL for an avatar with an empty string as the first parameter of get_avatar()
: http://2.gravatar.com/avatar/?s=64&d=mm&r=g
I pulled this from a Guest Author with no email set, but it can also be grabbed via wp shell
:
wp> get_avatar_url( '' );
=> string(43) "http://2.gravatar.com/avatar/?s=96&d=mm&r=g"
As you can see the fallback when there's no hash is a 200 response and the usual grey image.
Are you seeing something different?
Hi @GaryJones,
I should have also included those image URLs to make it easier for you, sorry!
The URLS you shared are the same I got. They are working correctly now, so I am sure it was a bug on Gravatar's side which had not been yet reported!
Thanks for getting back to me and sorry for the unnecessary hassle.
This is the function where the magic happens.
This bit checks if the user_email is set, but not if it's a blank string.
So if it is a blank string no user_email is sent to
get_avatar
and a 404 image is returned instead of the default fallback.I wonder if that is a new issue with how Gravatar works, since sending a string (not an email) is enough to get the fallback image back.