Gravatar头像打开速度很慢,解决办法

最近0.gravatar.com头像速度很慢,网页都打开了,状态栏还提示正在下载头像:

问题链接如:

http://0.gravatar.com/avatar/afd04f7f09dfb71394022ae24b0f98f5?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=X

介绍一个新方法:(更新时间:2011.05.06)

打开你主题内的function.php文件,最后一行添加以下代码:

// Quickly Gravatar
function quickly_gravatar($avatar) {
  $avatar = str_replace('?s=', '.png?s=', $avatar);
  $avatar = preg_replace("/([0-9])\.gravatar/i", "en.gravatar", $avatar);
  return $avatar;
}
add_filter('get_avatar', 'quickly_gravatar');

———————OVER————————-

以前应急的方法:

打开wp-includes/pluggable.php文件,查找(1648到1651行):

if ( !empty($email) )
$host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash{0} ) % 2 ) );
else
$host = 'http://0.gravatar.com';

替换为:

$host = 'http://gravatar.com';

以下是显示结果:
未修改的:
http://0.gravatar.com/avatar/ccdbe6a02e603e0f7de8da99a8841781?s=48&r=X

修改后的:

http://gravatar.com/avatar/ccdbe6a02e603e0f7de8da99a8841781?s=48&r=X

相关文章:

1、WordPress中mo和po文件编辑与转换
https://www.onexin.net/wordpress-mo-and-po-file-editing-and-conversion/

2、Wordpress自带Widget在模板中调用最新评论
https://www.onexin.net/wordpress-widget-comes-with-the-latest-comments-in-the-template-call/

3、TinyMCE Syntaxhighlighter Plugin for Wordpress
https://www.onexin.net/tinymce-syntaxhighlighter-plugin-for-wordpress/

4、Wordpress整合Ucenter最简单的实现方法
https://www.onexin.net/wordpress-integration-of-the-most-simple-implementation-ucenter/

5、Wordpress首页和分页类标题SEO优化
https://www.onexin.net/wordpress-home-page-and-category-page-titles-seo-optimization/

转载请注明出处:https://www.onexin.net/gravatar-picture-is-slow-to-open-the-solution/

4 Replies to “Gravatar头像打开速度很慢,解决办法”

    1. 被墙了,不过,看我的头像还活着。现在可以访问:http://en.gravatar.com/

      将原来的代码改成如下:
      $avatar = preg_replace(“/([0-9])\./i”, “en.”, $avatar);

      又复活了,哪里有官方,哪里就有我。

Leave a Reply

Your email address will not be published. Required fields are marked *