修改wordpress-头像gravatar源,加速国内访问

这里使用的loli.net源,国内访问速度迅速,比v2好点

将以下代码放到你主题的fucations.php中

/*gravatar使用lolo.net CDN*/
function replace_gravatar($avatar) {
$avatar = str_replace(array("//gravatar.com/", "//secure.gravatar.com/", "//www.gravatar.com/", "//0.gravatar.com/", 
"//1.gravatar.com/", "//2.gravatar.com/", "//cn.gravatar.com/"), "//gravatar.loli.net/", $avatar);
return $avatar;}
add_filter( 'get_avatar', 'replace_gravatar' );

本文转自:岁月小筑