搁在以前,WordPress头像地址是被墙掉的,导致评论的那些人啊连头像都没有。

而现在是可以打开了,但个人认为国外的服务器应该是没有国内快的,而且你也不知道啥时候又会被墙。

很感谢V2EX能提供国内的头像库。

//替换WORDPRESS默认头像网地址
//https://www.8fcn.com/204.html
if (!function_exists('replace_to_v2ex_avatar')) {
    function replace_to_v2ex_avatar($avatarUrl) {
        return preg_replace(["/[0-9]\.gravatar\.com\/avatar/", "/secure.gravatar\.com\/avatar/"], "cdn.v2ex.com/gravatar", $avatarUrl);
    }
}
add_filter('get_avatar', 'replace_to_v2ex_avatar');

速度稍微快了一点吧。

本文转载自八方博客:https://www.8fcn.com/204.html

参与评论