本文整理自网络,侵删。
最近打开博客后台,发现后台打开速度很慢。通过开发者调试工具对网络加载进行检测,发现是由于后台使用了谷歌字体的API。由于谷歌api被墙的缘故,导致我们的浏览器会反复的请求谷歌服务器而无法正常加载页面。
因此简单的解决方案就是禁用谷歌的字体api。
解决方法是添加下面的主题在目前的代码在functions.php:
PHP Code复制内容到剪贴板
- //禁用Open Sans
- class Disable_Google_Fonts {
- public function __construct() {
- add_filter( 'gettext_with_context', array( $this, 'disable_open_sans' ), 888, 4 );
- }
- public function disable_open_sans( $translations, $text, $context, $domain ) {
- if ( 'Open Sans font: on or off' == $context && 'on' == $text ) {
- $translations = 'off';
- }
- return $translations;
- }
- }
- $disable_google_fonts = new Disable_Google_Fonts;
标签:WordPress
相关阅读 >>
wordpress教程防wordpress广告的方法 评论中包含过多链接不可提交
解决更新wordpress3.7后db-cache缓冲插件冲突问题
更多相关阅读请进入《wordpress》频道 >>