Replacement of Gravatar server as a multi-talk solution to WordPress slow opening due to Gavatar servers

Recently, Gravatar server opens very slowly in China, even some places can't be opened at all, and the default avatar used in WordPress comment system is Gravatar's. This causes WordPress backend and post pages to open very slowly. WordPress comment system uses Gravatar as the default avatar, which causes WordPress background and post pages to open very slowly, and this problem can be solved by setting the background to not display avatars directly. However, if you don't show the avatar on the comment page, it will be very ugly. In fact, we just need to filter the function to show the avatar, and change the server of Gravatar to the one that is used for more comments. Code in the following.

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

Paste the above code directly into the functions.php file of the WordPress theme, and then try opening a post page with comments.

This feature has been integrated into my development of In the wizhi-optimization pluginYou can also get this feature directly by installing the plugin.

Related Posts

0 Comments

  1. The unreliability of this one is that the duowan source has many avatars who return to the source often, which still causes it to fail.
    Currently gravatar is also available at cn.gravatar.com and https protocol addresses.
    You can create a Seven Bulls bucket, mirror these two addresses, and then change the code above to the Seven Bulls address.

Leave a Reply

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