Public Services

Use Gravatar through a WebP-friendly endpoint.

Keep the avatar hash and path your application already uses, then replace the Gravatar hostname with our free public proxy.

General usage

Change the hostname from www.gravatar.com to gravatar.webp.se. The /avatar/:hash path stays the same.

Originalhttps://www.gravatar.com/avatar/:hashPublic servicehttps://gravatar.webp.se/avatar/:hash

WordPress

Add the following filter to your active theme's functions.php. It normalizes the standard Gravatar hostnames and then routes the generated avatar URL through the public service.

function use_webp_public_service($avatar) {
    $avatar = str_replace(
        array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"),
        "secure.gravatar.com",
        $avatar
    );
    $avatar = str_replace(
        "https://secure.gravatar.com",
        "https://gravatar.webp.se",
        $avatar
    );
    return $avatar;
}
add_filter("get_avatar", "use_webp_public_service");
WordPress theme editor showing the Gravatar hostname replacement filter
The original documentation example, migrated with the guide.

Theme files may be replaced during a theme update. If your site uses a child theme or a snippets plugin, place the filter there instead.