Site logo

Archived topic

Ensure text remains visible during webfont load issue

9 replies · Started by max on April 1, 2021

Viewing posts 1–10 of 10

hi how to solve this Ensure text remains visible during webfont load issue that we check from gtmetrix
thank you for your respond

Hi there,

There are different fonts being flagged.

1 is the Google font in use and the other is the GP font you use as an icon.

For the GP font icons:

Try changing the icons being used to SVG. This can be set through Appearance > Customize > General
https://docs.generatepress.com/article/svg-icons/

For the google font:
We can add font swap to the requested google font by using this PHP snippet.

add_filter( 'generate_google_font_display', function() {
    return 'swap';
} );

this need to put at which area?

add_filter( 'generate_google_font_display', function() {
return 'swap';
} );

this need to put at which area?

add_filter( ‘generate_google_font_display’, function() {
return ‘swap’;
} );

Here's how to add PHP snippets - https://docs.generatepress.com/article/adding-php/

You can put it on your child theme's functions.php or a Code Snippets plugin.

So after i put this code, al error from gtmetrix for Ensure text remains visible during webfont load issue will resolve?

Hi there,

it looks like its flagging the GP Icon fonts issue... don't bother adding the code Elvin provided.
Instead go to Customizer > General and change the Icon Type to SVG.

Make sure you clear ALL caches and refresh CDN ( if its being used )

Just want to reconfirm
I didnt need to put that code
Just change
Icon Type to SVG

Thats correct.

Thank you team
Tremendous respond

Glad we could be of help.

This archived topic is closed to new replies.