- This topic has 8 replies, 4 voices, and was last updated 4 years, 8 months ago by
David.
-
AuthorPosts
-
April 20, 2021 at 10:15 am #1742118
Sam
Hello,
I am getting this error along with a couple of others in lighthouse page speed test. I have tested my home page and a couple of image heavy blog posts. I was hoping you could help. Linking my site below.
April 20, 2021 at 6:30 pm #1742447Elvin
StaffCustomer SupportHi therem
You can try adding this:
add_filter( 'generate_google_font_display', function() { return 'swap'; } );Here’s how to add PHP: https://docs.generatepress.com/article/adding-php/
Let us know how it goes.
April 21, 2021 at 12:27 pm #1743665Sam
Thank you, that worked. Are there any fixes for some of the other errors coming up in lighthouse? I would attach the screen shot but I am no sure how.
April 21, 2021 at 4:11 pm #1743824Sam
Also, is the php you gave me the same as adding omgf google font plugin?
Thanks,
samApril 21, 2021 at 5:13 pm #1743858Elvin
StaffCustomer SupportThank you, that worked. Are there any fixes for some of the other errors coming up in lighthouse?
Can you open up a new topic for it? I’ve checked your site and there’s quite a lot to tackle.
…I would attach the screen shot but I am no sure how.
Check the recommendations here.
https://docs.generatepress.com/article/using-the-premium-support-forum/#uploading-screenshotsOr use CloudApp, Loom or Screencast.
Also, is the php you gave me the same as adding omgf google font plugin?
Not exactly sure what that plugin does but the principle is generally the same. It’s all about preloading the font, or in this case, setting
font-display: swap;on the requested Google fonts.April 21, 2021 at 5:28 pm #1743867Sam
Hello – opening new ticket now. thanks!
April 21, 2021 at 5:36 pm #1743875Elvin
StaffCustomer SupportNo problem. 🙂
August 27, 2021 at 9:46 pm #1910617NeedForGaming
How to add this code
add_filter( ‘generate_google_font_display’, function() {
return ‘swap’;
} );August 28, 2021 at 5:22 am #1910816David
StaffCustomer SupportHi there,
that is a PHP Snippet – this article explains how to add:
https://docs.generatepress.com/article/adding-php/
Please note: Adding display swap may remove the:
Ensure text remains visible during webfont load Page Insightsdiagnostic on Google PSI. BUT it can lead to CLS issues. I would only use that option if i am 100% sure that the font swapping won’t cause CLS. -
AuthorPosts
- You must be logged in to reply to this topic.