Stop loading fonts from Google (webfont.js)
-
I am working on optimizing a website for a client and I noticed MailOptin loads the fonts that it needs from google using webfont.js script.
I don’t want to have extra fonts loading on the site, The WordPress theme already loads the fonts it uses.
How do I disable this in the plugin?
I tried setting font family everywhere to “inherit from theme” and it did not help…BTW I know this is MailOptin loading this script because 1. When I disabled the plugin it disappeared. 2. I used this handy script to find out the Handles for enqueued WordPress scripts and its handle was “mo-google-webfont”.
add_filter( 'script_loader_tag', 'find_out_script_handles', 10, 3 ); function find_out_script_handles( $tag, $handle, $src ) { return str_replace( '<script', sprintf( '<script data-handle="%1$s"', esc_attr( $handle ) ), $tag ); }Meanwhile, I managed to disable it using this script in the functions.php file
function mo_google_webfont_dequeue_script() { wp_dequeue_script( 'mo-google-webfont' ); } add_action( 'wp_print_scripts', 'mo_google_webfont_dequeue_script', 100 );I think this is a flaw of plugin and it needs to be fixed.
Thanks- This topic was modified 5 years, 10 months ago by .
The topic ‘Stop loading fonts from Google (webfont.js)’ is closed to new replies.