wordpress后台打开缓慢的临时解决方法
最近打开源码街,发现在后台打开很慢。
通过开发调试工具的网络负载测试,发现是由于后台使用谷歌字体API。因为谷歌是墙API的缘故,因为我们的一再要求谷歌服务器和浏览器不加载页面。
如此简单的解决办法是禁用谷歌字体API。
解决方法是添加下面的主题在目前的代码在functions.php:
//禁用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