加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > CMS系统 > wordpress > 正文

禁用wordpress gravatar使用本地头像提高网页打开速度

发布时间:2020-12-14 14:47:57 所属栏目:wordpress 来源:网络整理
导读:WordPress默认的头像是读取gravatar.com上的图片的,对于国内用户来说会使网页打开速度变慢。所以我决定删除掉这块功能。 修改get_avatar函数,在wp-includes/pluggable.php内。修改后的函数如下: div class="msgborder" id="phpcode33" if ( !function_exi

WordPress默认的头像是读取gravatar.com上的图片的,对于国内用户来说会使网页打开速度变慢。所以我决定删除掉这块功能。 修改get_avatar函数,在wp-includes/pluggable.php内。修改后的函数如下: <div class="msgborder" id="phpcode33"> 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;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读