欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

禁用wordpress gravatar使用本地頭像提高網(wǎng)頁打開速度

  發(fā)布時間:2013-11-26 17:49:28   作者:佚名   我要評論
WordPress默認的頭像是讀取gravatar.com上的圖片的,對于國內用戶來說會使網(wǎng)頁打開速度變慢,下面為大家分享個為wordpress提速使用本地頭像的方法,需要的朋友不要錯過
WordPress默認的頭像是讀取gravatar.com上的圖片的,對于國內用戶來說會使網(wǎng)頁打開速度變慢。所以我決定刪除掉這塊功能。

修改get_avatar函數(shù),在wp-includes/pluggable.php內。修改后的函數(shù)如下:

復制代碼
代碼如下:

if ( !function_exists( 'get_avatar' ) ) :
/**
* Retrieve the avatar for a user who provided a user ID or email address.
*
* @since 2.5
* @param int|string|object $id_or_email A user ID, email address, or comment object
* @param int $size Size of the avatar image
* @param string $default URL to a default image to use if no avatar is available
* @param string $alt Alternate text to use in image tag. Defaults to blank
* @return string tag for the user's avatar
*/
function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
if ( ! get_option('show_avatars') )
return false;
if ( false === $alt)
$safe_alt = '';
else
$safe_alt = esc_attr( $alt );
if ( !is_numeric($size) )
$size = '96';
$default = includes_url('images/blank.gif');
$avatar = "";
return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
}
endif;

即使用該函數(shù),僅可能返回一個默認頭像(位于wp-includes/images/blank.gif內),再配合simple local avatars或Add Local Avatar插件,就實現(xiàn)了預期的效果。

相關文章

最新評論