How to get gravatar url alone

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 Comment