Tagged: google fonts
-
AuthorPosts
-
February 11, 2019 at 3:51 pm #1065466
I’ve put my Google Fonts locally and want to disable the external Google Fonts requests to speed up my website. I’ve looked in the Enfold settings, but can’t find an option to disable that. Is this possible and how?
Thanks.
Mark
February 11, 2019 at 4:50 pm #1065495and you have truely activated the fonts localy?
so here is the code to hamper loading of Google Fonts from google in Enfold
it comes to your child-theme functions.php:add_action( 'init', 'enfold_customization_switch_fonts' ); function enfold_customization_switch_fonts() { global $avia; $avia->style->print_extra_output = false; }
by the way – this little plugin i got additionally loaded: remove-google-fonts-references
Allthough it is not tested for new WordPress- on my end i can say that it works for WP 5.0.3.February 11, 2019 at 4:57 pm #1065504Just because you prevent Google Fonts from loading themes Internally from Google Servers doesn’t mean you can’t still use the stuff in the Enfold settings.
If your fonts are in the Enfold list – you can choose them and use them – only the loading via Google Servers are hampered by this code above.
If you have installed new fonts, you can reintegrate them according to the known method.
f.e:add_filter( 'avf_google_heading_font', 'avia_add_heading_font'); function avia_add_heading_font($fonts) { $fonts['Source Sans Pro'] = 'Source Sans Pro:300,300i,400,400i,700,700i'; return $fonts; } add_filter( 'avf_google_content_font', 'avia_add_content_font'); function avia_add_content_font($fonts) { $fonts['Source Sans Pro'] = 'Source Sans Pro:300,300i,400,400i,700,700i'; return $fonts; }
February 11, 2019 at 5:50 pm #1065533Thank you Guenni007,
I use the plugin CAOS for Webfonts where you download specified fonts (that you use on your website) locally and it creates a stylesheet for them. If I’m going to use new fonts later on, I also download them via the CAOS plugin and then it will generate a new stylesheet.The instructions state that the next step is to remove external Google Fonts references.
So I guess I can either use the (outdated) plugin you suggested or paste the first code in functions.php.
If the plugin was still maintained I for sure would’ve picked the plugin option.
Mark
February 11, 2019 at 6:17 pm #1065560Try first the code above. But it only removes the enfold support for loading google fonts form Google Servers.
But there are a lot of Google Font GDPR conflicts – f.e. on loading a google map the Roboto Font is always loaded. So it might be good to totaly refuse Goolge Server loadingFebruary 11, 2019 at 6:49 pm #1065600Your code works :-)
I saw also WP plugins that even take care of fonts used in plugins. Maybe they also take Google Maps into account?For now, I’m satisfied.
Mark
February 12, 2019 at 11:13 pm #1066131Hi,
Thank you for letting us know – we appreciate it a lot.
Best regards,
Basilis -
AuthorPosts
- The topic ‘How to remove external Google Fonts requests?’ is closed to new replies.