/wp-content/plugins/elementor/includes/font.php
删除下面两行
self::GOOGLE => __( 'Google', 'elementor' ),
self::EARLYACCESS => __( 'Google Early Access', 'elementor' ),
禁用前端谷歌字体
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Dequeue Google Fonts based on URL.
*/
function drgf_dequeueu_fonts() {
global $wp_styles;
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
return;
}
$allowed = apply_filters(
'drgf_exceptions',
[ 'olympus-google-fonts' ]
);
foreach ( $wp_styles->registered as $style ) {
$handle = $style->handle;
$src = $style->src;
$gfonts = strpos( $src, 'fonts.googleapis' );
if ( false !== $gfonts ) {
if ( ! array_key_exists( $handle, array_flip( $allowed ) ) ) {
wp_dequeue_style( $handle );
}
}
}
// Dequeue Google Fonts loaded by Revolution Slider.
remove_action( 'wp_footer', array( 'RevSliderFront', 'load_google_fonts' ) );
}
add_action( 'wp_enqueue_scripts', 'drgf_dequeueu_fonts', 9999 );
add_action( 'wp_print_styles', 'drgf_dequeueu_fonts', 9999 );
/**
* Dequeue Google Fonts loaded by Beaver Builder.
*/
add_filter(
'fl_builder_google_fonts_pre_enqueue',
function( $fonts ) {
return array();
}
);
/**
* Dequeue Google Fonts loaded by Elementor.
*/
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' )