WordPress中gravatar评论头像不显示的解决办法

我们知道只是http://0.gravatar.com这个分流服务器被墙,但是en.gravatar.com及cn.gravatar.com还是可以正常访问的,可以通过修改头像调用文件来解决,具体方法如下:

找到/wp-includes/pluggable.php这个文件,找到下面这段代码:

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

修改为:

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

或者:

if ( is_ssl() ) {
$host = 'https://secure.gravatar.com';
} else {
$host = 'http://en.gravatar.com';
}

注:不要用windows自带的记事本编辑,可能会出错的,推荐使用Dreamweaver或者notepad++进行编辑

其中en.gravatar.com是官方的地址,也可以修改为cn.gravatar.com

以及国内的gravatar.duoshuo.com或者ruby-china.org

附:WordPress 4.2.1中Gravatar评论头像不显示的解决办法
http://429006.com/article/technology/3631.htm

This entry was posted in Technology and tagged , , , . Bookmark the permalink. 3,429 views

Related Posts

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>