乌徒帮技术范WordPressWordPress使用 › 谷歌被墙之后WordPress内部字体导致网页加载速度慢的解决方法

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

分类:WordPress使用
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;
填写个人信息,赶快回复吧!