禁止连接fonts.googleapis.com

方法三:
把方法一、二中functions.php文件添加的函数删除,
安装Disable Google Fonts插件,并启用。
方法二:
添加下面的代码到当前所用的主题的functions.php中即可:
/**
* WordPress 后台禁用Google Open Sans字体
*/
add_filter( ‘gettext_with_context’, ‘ht_disable_open_sans’, 888, 4 );
function ht_disable_open_sans( $translations, $text, $context, $domain ) {
if ( ‘Open Sans font: on or off’ == $context && ‘on’ == $text ) {
$translations = ‘off’;
}
return $translations;
}
方法一:
添加下面的代码到当前所用的主题的functions.php中即可:
/**
* WordPress 后台禁用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;