wordpress如何禁用Google Fonts解决网站加载缓慢

maolai 网站建设wordpress如何禁用Google Fonts解决网站加载缓慢已关闭评论156阅读模式

谷歌在2014.6月初被国内屏蔽。导致wordpress访问十分缓慢。wordpress程序有的版本和部分国外wordpress主题会加载谷歌字体,调用fonts.googleapis或googleapis内容。通过修改,可以加快网站访问速度。

1.删掉系统里面的谷歌字体

在wp-includes文件夹里找到“script-loader.php”文件,通过ftp传送到电脑本地打开,在代码中找到“fonts.googleapis.com”,将其改成“fonts.useso.com”即可.

wordpress如何禁用Google Fonts解决网站加载缓慢

2.删掉主题里面的谷歌字体

打开主题里的functions.php文件,在代码中找到“fonts.googleapis.com”,将其改成“fonts.useso.com”即可.另外可以通过下载Disable Google Fonts 插件来进行设置。

如此,访问前台的速度就会快很多了.如果fonts.useso.com已失效,可在主题functions.php文件下添加以下代码禁止fonts.googleapis.com加载。

//禁用Google Fonts解决WordPress加载速度缓慢的问题
    function googlo_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', 'googlo_remove_open_sans_from_wp_core');

 
maolai
  • 本文由 maolai 发表于 2015年4月8日 21:40:32
  • 转载请务必保留本文链接:http://www.bokequ.com/360.html