Gravatar Usage Examples #
General #
Change the link from https://www.gravatar.com/avatar/:hash
to https://gravatar.webp.se/avatar/:hash
.
Wordpress #
Edit your theme, and add the following code inside the functions.php
:
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');
like this: