将下面的代码放入到当前主题的 functions.php 文件中,然后保存即可:
方法一:
//禁用 Google Fonts
function fanly_disable_google_fonts($translations, $text, $context, $domain ) {
$google_fonts_contexts = array('Open Sans font: on or off','Lato font: on or off','Source Sans Pro font: on or off','Bitter font: on or off');
if( $text == 'on' && in_array($context, $google_fonts_contexts ) ){
$translations = 'off';
}
return $translations;
}
方法二:
//禁用 Google Fonts
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' );
以上代码二选一放置即可。