快速加载gravatar头像

原料
1.

function unblock_gravatar( $avatar ) {
$avatar = str_replace( array( 'http://www.gravatar.com', 'http://0.gravatar.com', 'http://1.gravatar.com', 'http://2.gravatar.com' ), 'https://cn.gravatar.com', $avatar );
return $avatar;
}
add_filter( 'get_avatar', 'unblock_gravatar' );

2.

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

做法:加入到 主题内 functions.php

1参考:https://www.juwends.com/usages/new_gravatar_mirror_config.html
2转载:https://ihuan.me/3429.html

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据