- This topic has 13 replies, 2 voices, and was last updated 3 years, 3 months ago by
Ying.
-
AuthorPosts
-
August 7, 2018 at 1:59 pm #642694
sumanta
To increase the performance of my site, I want to store a couple of Google fonts in my server and remove any requests to Google server. I did these:
1. Hosted Open Sans locally using the guide below and now I can see Open Sans in my system font list of Customizer.
https://docs.generatepress.com/article/adding-local-fonts/2. Tried to remove Google font completely but failed.
Added this using Code Snippets plugin (ref: https://generatepress.com/forums/topic/how-to-disable-google-fonts-or-update-enqueing-process/):add_action( ‘wp_enqueue_scripts’,’tu_remove_google_fonts’, 10 );
function tu_remove_google_fonts() {
wp_dequeue_style( ‘generate-fonts’ );
}But I can still see Google fonts in Customizer. Please help.
By the way, are these the right way to avoid any request to Google font server?
(My site is an intranet site, so cannot share the web link)
Thank you.
August 7, 2018 at 6:42 pm #642882Tom
Lead DeveloperLead DeveloperHi there,
There’s no need to remove Google Fonts from the Customizer itself. If you choose the Open Sans you added locally, GeneratePress won’t load anything from Google.
The fonts will still display as options in the Customizer, but the front end of your site won’t make any calls to Google.
Let me know if that makes sense or not 🙂
August 7, 2018 at 8:49 pm #642916sumanta
Thank you Tom. I will try that.
August 8, 2018 at 8:30 am #643341Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
November 10, 2019 at 2:00 am #1058329ic7
Hi Tom,
sorry to pick up this old topic, but I have a question.
Even if it is not necessary to remove all the font choices in the customizer, would this still somehow be possible? If a site already uses for example two different local fonts, in some scenarios it would be good if only these two local font choices were presented in the typography settings inside the customizer.November 10, 2019 at 3:37 am #1058374David
StaffCustomer SupportHi there,
this article provides the PHP snippet to remove the google font list from the customizer:
November 11, 2019 at 1:10 am #1059143ic7
Hi David,
thanks for reminding me of these snippets. I tried these a while ago and the second snippet for removing the font list somehow didn’t work. I now tried the snippet and this time it worked.
Is there a way of also removing the list of system fonts, resulting in only having the locally uploaded fonts in the list?
November 11, 2019 at 6:29 am #1059389David
StaffCustomer SupportI don’t think there is a filter for that.
November 13, 2019 at 1:17 am #1061446ic7
Hi David,
I just wanted to let you know that the snippet for removing the Google Fonts from the typography menues (https://docs.generatepress.com/article/remove-google-fonts/) throws the following PHP warning, if DEBUG mode is activated:
Warning: array_key_exists() expects parameter 2 to be array, bool given in .../plugins/gp-premium/typography/functions/migration.php on line 170
Since it’s just a warning no problem at all, I just wanted to let you know.
I guess you can’t do much about it, because the array gets removed by the filter mentioned above.November 13, 2019 at 8:44 am #1062103Tom
Lead DeveloperLead DeveloperThanks for the heads up! Just adjusted the function 🙂
November 15, 2019 at 12:37 am #1063646ic7
Perfect! Thank you very much!
November 15, 2019 at 8:17 am #1064132Tom
Lead DeveloperLead DeveloperNo problem!
May 24, 2022 at 2:29 pm #2231517Stefan
Hi Generate Press Team,
I used the instructions here to remove Google Fonts:
https://wordpress.org/support/topic/remove-preconnect-to-https-fonts-gstatic-com/But, that did not completely remove Google Fonts.
I previously used native Google Fonts (Ubuntu and Lora) and I tried to clean up my website but maybe there are still some vestiges of Google. Actually, I can still see Google Fonts (Ubuntu) making a request as seen in this GT Metrix Report (https://gtmetrix.com/reports/www.lifestyledemocracy.com/zL5Qp1Dh/).
I would appreciate your support in completely removing Google Fonts from my website/GP theme.
Looking forward to your tips.
Stefan
May 24, 2022 at 2:43 pm #2231533Ying
StaffCustomer SupportHi Stefan,
This is an old topic, as we rebuilt the typography system, now you don’t need to add any PHP snippet to remove Google fonts if you are using the dynamic typography.
https://docs.generatepress.com/article/switching-to-dynamic-typography/If there’s no Google fonts are added at customizer > typography > font manager, then GP won’t call for any Google fonts.
Make sure cache is cleared, if your site still requests Google fonts, try disable all plugins and test again as there might be some plugin is using Google fonts.
-
AuthorPosts
- You must be logged in to reply to this topic.