下载了几个插件后,这个网站访问速度巨慢,观察一直在访问http://fonts.googleapis.com/,还有一个情况是更新文章和发布,操作“All in seo”这个插件就执行不能访问的问题…
☁️分析:1.head加载太多 2.缓存问题
屏蔽方式一:
下载插件 Useso take over Google(现在发现这个插件也扯淡) 和 Disable Google Fonts 来替换或者关闭
屏蔽方式二:在functions.php中加一段代码,就可以屏蔽谷歌代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
#禁用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; #或者下面这段代码也可以: function 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’, ‘remove_open_sans_from_wp_core’ ); |
访问速度受限,除了上面屏蔽方式外,看下是不是哪个不用的插件或者引入了google字体,没有的就直接删掉。