有很多朋友反映,在使用WordPress程序的网站时,不论打开网站前台或是后台,速度都是非常慢。

WordPress是国外很流行的开源博客程序,很多主题,JS脚本,甚至字体都严重依赖GOOGLE的公共类库,由于众所周知的原因,国内用户访问Google会存在一些问题。下面给出3种解决方法:

一、修改程序,禁用WP的GOOGLE字体。
通过在函数文件functions.php文件中添加以下代码禁用谷歌字体:

 function coolwp_remove_open_sans_from_wp_core() { wp_deregister_style(
‘open-sans’ ); wp_register_style( ‘open-sans’, false );
 wp_enqueue_style(‘open-sans’,”); } add_action( ‘init’,
 ‘coolwp_remove_open_sans_from_wp_core’ );

二、通过WP插件禁用GOOGLE字体:
插件名称:Remove Open Sans font Link from WP core
插件地址:http://wordpress.org/plugins/remove-open-sans-font-from-wp-core/

三、通过“移花接木”,通过360推出的国内镜像服务,来绕过GOOGLE来使用字体服务,速度也不受影响:
依次打开 /wp-includes/script-loader.php,约581行的位置,搜索 “fonts.googleapis.com” 替换为 “fonts.useso.com” ,保存上传即可。

标签: wordpress

添加新评论