Archived topic
Removing Google Fonts from child theme
3 replies · Started by Christian on July 21, 2022
Hi,
I have a site (see private info section) that's on Ezoic ads. They're saying I should disable Google Fonts API.
They sent me their support article here: https://wordpress.ezoic.com/how-to-remove-google-fonts-from-your-wordpress-site/. Under the "Custom Child Themes Available for Download without Google Fonts" section, they want me to download certain Google Fonts child theme. However, I set up a child theme already a few days back.
I added the code in the first block in this article: https://docs.generatepress.com/article/remove-google-fonts/ to my child's theme function PHP file.
However, when I check gtmetrix Google fonts is still present.
Can you please help me remove google fonts from the way I have my current child theme?
Hi Christian,
Where did you add the code? Can you try this code instead?:
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'generate-google-fonts' );
},99 );
Moreover, by default, if you don’t use Google Fonts anywhere in your site, it shouldn’t be loaded.
Are you loading it in the typography module? Can you toggle it off there?
Moreover, if you’re using GenerateBlocks, and using Google fonts in any of the blocks, kindly remove it from there as well.
Hope this clarifies!
Hi Fernando,
Thanks for that code.
I added it to my GP Child Theme Functions.php file.
I checked the typography module, and it's not on. This is what I see: https://prnt.sc/vM896okYGKHa
Can you confirm that Google fonts are not loading on my site now that I have the new code installed?
Hi there,
i do not see any Google Font requests being made on your site.