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

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

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

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

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

Leave a Reply