I would like to use gravatar image as background image for a button. When i use get_avatar function it returns with height width src parameters.

But i need only gravatar url.
I mean like http://gravatar.com/.../...

Can anyone tell me how?
Thanks

2 Answers
2

Just generate the URL yourself. It’s just a hash of the user’s email address.

function get_gravatar_url( $email ) {
    $hash = md5( strtolower( trim ( $email ) ) );
    return 'http://gravatar.com/avatar/' . $hash;
}

This function requires that you pass the user’s email address in … but you could do anything you need to programatically grab the user’s address.

Leave a Reply

Your email address will not be published. Required fields are marked *