Site logo

Archived topic

Google Font API removal with GP child theme?

8 replies · Started by Adam on January 30, 2022

Viewing posts 1–9 of 9

Hello,

I am currently running GP premium and running Ezoic ads on my blog. My Ezoic representative has recommended I remove Google Font API, as it will slow down my site and we are trying to improve my loading scores.

As I understand my options are to edit with custom code in the theme editor (yikes, scary!) or install a special 'child theme' that does not have the Google Fonts API.

Before I proceed- what does GP recommend? Is there an easier method or something I need to be aware of? I have ZERO coding background and very limited tech skills, so I am not sure the best course of action...

Here is a link to the resource I was given by Ezoic:
https://wordpress.ezoic.com/how-to-remove-google-fonts-from-your-wordpress-site/

Hi Adam,

Yes, it’s correct that Google fonts may slow down a site, however, before we recommend, may we know how you’re setting the fonts in your website to know if Google Fonts is necessary or not?

This is important since turning off Google fonts in the Customizer may result in your site not loading the intended fonts as selected.

Nonetheless, to turn off Google font in GP Premium, you’ll simply need to toggle off Google font in any Font you use in Appearance > Customizer > Typography.

See this for reference: https://share.getcloudapp.com/jkumXGWL

Moreover, if you’re using Google Fonts through GenerateBlocks, you’ll also need to toggle it off there.

See this for reference: https://share.getcloudapp.com/6quEzlbq

As an alternative, you may host fonts locally if you want to use fonts other than System default ones after turning off Google fonts from the Customizer and/or GenerateBlocks to ensure that the site has the necessary fonts to display.

Here is a link on how to add fonts locally: https://docs.generatepress.com/article/adding-local-fonts/

Hope this helps! :)

Hi Fernando, how do I determine if I am using google fonts? When I go to typography...this is what I see:

>Body: Font Family 'Open Sans'
>Header, Navigation, and everything else all says "Inherit"...

And I dont see any switch to toggle google fonts on or off like in your reference examples...

Hi there,

if your site was built pre GP 3.1 then it will be using the Old Typography system.
And that means your Open Sans font selection will by default load it from Google Fonts.

If you can share a link to the site then i can check that ?

Hi David, thanks. Sure here you go:

Hello, did you get the link?

Hi Adam,

Thank you for sending the link to your website! Upon viewing your site, I was able to confirm that it is indeed using the Old Typography system. Specifically, I was able to see that Open Sans is coming from Google Fonts.

If you wish to remove Google Fonts and host your fonts locally, you’ll first need to add this custom snippet:

add_action( 'wp_enqueue_scripts', function() {
    wp_dequeue_style( 'generate-fonts' );
} );

See this for reference: https://docs.generatepress.com/article/remove-google-fonts/

See this for reference with regards on how to add custom PHP: https://docs.generatepress.com/article/adding-php/

Then, you’ll need to host the fonts you’ll be using in your website locally.

Here is a link on how to host fonts locally: https://docs.generatepress.com/article/adding-local-fonts/

Hope this helps! :)

Is there an easier way or another option? I don't even know what PHP is, and I don't feel comfortable adding or editing code...I literally have ZERO tech background. I am a content creator!

I’m afraid that the current provided steps is the safest and easiest route to achieve your goal.

The other way would be to create a child theme and manually remove the code which enqueues the fonts.

I personally use the plugin Code snippets, and here is a short screen recording of how you can add the PHP snippet in Code snippets plugin to remove Google Fonts: https://share.getcloudapp.com/DOumkdDr

Moreover, Upwork.com and Freelancer.com are two websites you may also go to for assistance if you’re not comfortable adding the code by yourself. Be weary if you choose this route as choosing someone not knowledgeable or trustworthy might break your site. We also don’t guarantee outside services.

Another place you may go to is our official Facebook Group: https://www.facebook.com/groups/generatepress.

In terms of site speed, I tried doing a speed test on the 2 websites linked to your account, panfishnation.com and outdoorsmecca.com. Correspondingly, I found that the speed of these websites are already impressively high with a score of 98 and 100 respectively.

See: https://share.getcloudapp.com/qGurZOp9

Also see: https://share.getcloudapp.com/YEuBDkmb

Hope this helps! Feel free to let us know if any further assistance is needed. :)

This archived topic is closed to new replies.