How to stop Google Fonts from loading?

In my theme I use Adobe Typkit. But on google page speeds test, I see

https://fonts.googleapis.com/…mily=Playfair+Display%3A400|Lato%3A300

https://fonts.googleapis.com/…mily=Playfair+Display%3A400|Lato%3A300

(these two even though one is a duplicate)

How do I stop them loading since these were picked on my theme settings before I chose to go use typekit ?

Hey @ianizaguirre,

Are you using the Font Manager? If so, please go to Appearance > Customize and ensure you don’t have a Google font setup under Typography and Header. This is currently a known issue.

If that does not help, please give us WP admin access in a Secure Note.

Thanks.

When I go to those settings, it shows that I have set my fonts to typekit not google fonts. So that is not where the problem is coming from. I have attached my details in a secure note. Please let me know what was fixed so I can know for the future. Thank you

Hi there,

Please try adding this code in the function.php file of the child theme:

// Remove Google Fonts
// =============================================================================

function x_remove_google_fonts(){
  wp_dequeue_style( 'x-font-custom' );
  wp_dequeue_style( 'x-font-standard' );
}
add_action( 'wp_enqueue_scripts', 'x_remove_google_fonts', 100 );

// =============================================================================

Hope this helps.

Hmm I added that to my child themes functions.php but on Google PageSpeed Insights, under “Eliminate render-blocking JavaScript and CSS in above-the-fold content” , it still shows the google font scripts being loaded? So I dont think that code helped , i’m not sure ?

Hi,

Please try this code instead.

  add_action( 'wp_enqueue_scripts', function() {
  wp_dequeue_style( 'x-google-fonts' );
}, 99 );

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.