woredpress去除加载谷歌字体

1,478次阅读
2 条评论

    前几天打开我网站的时候发现不管前台还是后台都很慢,后来才知道原来wordpress默认使用了谷歌字体服务,因为众所周知的原因,墙变硬了,把绝大部分的谷歌服务干掉了,只要在wordpress的主题文件中加一段代码屏蔽谷歌字体服务就可以了。
   在主题的functions.php文件夹加入下列代码即可实现

// 去除加载谷歌字体
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;

另外给两个能正常使用的谷歌搜索的ip

http://203.208.46.148/

http://203.208.36.19/

正文完
 0
评论(2 条评论)
2014-06-10 09:20:29 回复

国人不自强啊,貌似360弄了个字体

 Windows  Chrome  日本东京都东京KDDI
    2014-06-10 09:41:16 回复

    我直接删除了,谷歌字体也没多大用

     Windows  Chrome  中国贵州省黔南铁通