关闭google fonts补全

来北京出差快2周了.blog都长草了哈哈哈

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;

 

// remove_wp_open_sans
if (!function_exists('remove_wp_open_sans')) {
    function remove_wp_open_sans() {
        wp_deregister_style( 'open-sans' );
        wp_register_style( 'open-sans', false );
    }
    // Uncomment below to remove from admin
    add_action('admin_enqueue_scripts', 'remove_wp_open_sans');
}
function remove_open_sans() {
        wp_deregister_style( 'open-sans' );
        wp_register_style( 'open-sans', false );
        wp_enqueue_style('open-sans','');
}
add_action( 'init', 'remove_open_sans' );

 

Share

小 虾

哦也,我是小虾

You may also like...

2 Responses

  1. Caola says:

    我还是喜欢用谷歌的字体库,所以自己反代了一下,虽然360的CDN库也有反代,但他不支持https方式,所以我还自己反代了一下(fonts.cao.la)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.