填写您的邮件地址,订阅我们的精彩内容:

谷歌被墙之后WordPress内部字体导致网页加载速度慢的解决方法

955
function remove_wp_open_sans() {
? wp_deregister_style('open-sans');
? wp_register_style('open-sans',false);
? wp_enqueue_style('open-sans','');
}
add_action('wp_enqueue_scripts', 'remove_wp_open_sans');

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

下面我简单说几句