wordpress后台加载ajax.googleapis.com导致打开速度很慢的解决方案
2015-04-17 15:25
706 查看
wordpress后台加载ajax.googleapis.com导致打开速度很慢的解决方案
解决方案:
在主题的functions.php里面添加如下代码:
2.
禁用wordpress gravatar使用本地头像提高网页打开速度
修改get_avatar函数,在wp-includes/pluggable.php内。修改后的函数如下:
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;
即使用该函数,仅可能返回一个默认头像(位于wp-includes/images/blank.gif内),再配合simple local avatars或Add Local Avatar插件,就实现了预期的效果。
3.
删除代码:很多人不喜欢用插件那么这个可以修改代码打开/wp-includes/script-loader.php搜索fonts.googleapis.com找到代码位置,直接把//fonts.googleapis.com/…这个链接整个删掉即可
4.依次打开 /wp-includes/script-loader.php,约581行的位置,替换谷歌的字体库为360网站卫士的国内CDN节点(推荐)将上图截图中箭头指示的fonts.googleapis.com换成fonts.useso.com即可。
5.
http://libs.useso.com/
解决方案:
在主题的functions.php里面添加如下代码:
function hc_cdn_callback($buffer) { return str_replace('googleapis.com', 'useso.com', $buffer); } function hc_buffer_start() { ob_start("hc_cdn_callback"); } function izt_buffer_end() { ob_end_flush(); } add_action('init', 'hc_buffer_start'); add_action('shutdown', 'hc_buffer_end');
2.
禁用wordpress gravatar使用本地头像提高网页打开速度
修改get_avatar函数,在wp-includes/pluggable.php内。修改后的函数如下:
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;
即使用该函数,仅可能返回一个默认头像(位于wp-includes/images/blank.gif内),再配合simple local avatars或Add Local Avatar插件,就实现了预期的效果。
3.
删除代码:很多人不喜欢用插件那么这个可以修改代码打开/wp-includes/script-loader.php搜索fonts.googleapis.com找到代码位置,直接把//fonts.googleapis.com/…这个链接整个删掉即可
4.依次打开 /wp-includes/script-loader.php,约581行的位置,替换谷歌的字体库为360网站卫士的国内CDN节点(推荐)将上图截图中箭头指示的fonts.googleapis.com换成fonts.useso.com即可。
5.
360网站卫士常用前端公共库CDN服务
http://libs.useso.com/
相关文章推荐
- 黄聪:wordpress后台加载ajax.googleapis.com导致打开速度很慢的解决方案
- 黄聪:wordpress后台导致fonts.googleapis.com、ajax.googleapis.com加载慢的解决方法
- (转)关闭WordPress自动加载的Open Sans字体,总是连接googleapi.com,导致打开wordpress很慢
- Joomla使用ajax.googleapis.com导致网页加载非常慢的解决方法
- fonts.googleapis.com ajax.googleapis.com wordpress加载慢的解决方法【转】
- fonts.googleapis.com ajax.googleapis.com wordpress加载慢的解决方法
- 黄聪:如何删除wordpress登录之后wp_footer、wp_head自行加载的Open Sans字体、fonts.googleapis.com连接导致卡死的问题
- fonts.googleapis.com, ajax.googleapis.com加载缓慢的解决方法
- Wordpress 打开首页老是加载themes.googleusercontent.com 的解决办法
- fonts.googleapis.com 谷歌字体库加载过慢解决方案
- (http://fonts.googleapis.com/css?)打开很慢解决方案
- http://fonts.googleapis.com/css?打开很慢解决方案
- 原 ajax.googleapis.com等公共库加载被“墙”的解决方法!
- wordpress后台禁用Google Open Sans字体提高加载速度
- 解决Odoo访问fonts.googleapis.com导致速度慢的问题
- 解决Odoo访问fonts.googleapis.com导致速度慢的问题
- 解决Odoo访问fonts.googleapis.com导致速度慢的问题
- (http://fonts.googleapis.com/css?)打开很慢解决方案
- ajax.googleapis.com 加载慢的解决方法
- 完美解决wordpress无法加载google字体等导致速度缓慢的方法