首页 > Wordpress > wordpress屏蔽google字体加载
2014
06-09

wordpress屏蔽google字体加载

最近google貌似被和谐了,国内好多wordpress的站都卡在了google字体那里(fonts.goo…)进不去了,有的要等好久,下面就教大家一个方法来屏蔽google字体。

在你主题的文件中加上下面函数

//禁用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;

刷新看看是不是不用再等待了。

最后编辑:
作者:漱石
这个作者貌似有点懒,什么都没有留下。
捐 赠如果您觉得这篇文章有用处,请支持作者!鼓励作者写出更好更多的文章!

留下一个回复