wordpress的Gravatar加速

今天打开博客,无意中发现加载Gravatar需要很久,明显使我的博客变慢,后来经百度发现一个简洁而又方便的方法,解决了这个问题。把代码直接扔进主题functions.php中就可以了

function ruigang_get_avatar($avatar) {
$avatar = str_replace(array("www.gravatar.com","0.gravatar.com","1.gravatar.com","2.gravatar.com"),
"gravatar.duoshuo.com",$avatar);
return $avatar;
}
add_filter( 'get_avatar', 'ruigang_get_avatar', 10, 3 );

Continue reading ‘wordpress的Gravatar加速’ »