使用V2EX的CDN解决Gravatar加载慢问题

August 04, 2016

在主题的 function.php 中,在最后面添加:

//replace Gravatar from V2EX
function my_get_avatar( $avatar ) {
    $avatar = preg_replace("/https:\/\/(secure|\d).gravatar.com\/avatar\//","https://cdn.v2ex.com/gravatar/",$avatar);
    return $avatar;
}
add_filter('get_avatar', 'my_get_avatar');

Profile picture

Written by Armin Li , a venture capitalist. [Weibo] [Subscribe]