PageSpeed Insights

Elementor Google PageSpeed custom font issues
Ensure text remains visible during webfont load

page speed insights web font load

1. Add this code to functions.php – I used the Code Snippets plugin to easily add it, see below.

				
					add_filter( 'elementor_pro/custom_fonts/font_display', function( $current_value, $font_family, $data ) {
	return 'swap';
}, 10, 3 );
				
			

2.  Install the plugin Code Snippets

screenshot-code-snippets

3.  I used the plugin Code Snippets

  • Snippeds > Add New
  • Add a title
  • Paste in code
  • Save changes and activate

4.  Regenerate fonts

  • Elementor > Custom fonts
  • Edit each custom font and update (will not make any change but will regenerate the fonts).

5.  Regenerate Elementor CSS & Data

  • Elementor > Tools
  • Click on Regenerate Files & Data
  • Save Changes

6.  Test in PageSpeed Insights

  • you should now have passed ‘Ensure text remains visible during webfont load’ 

I hope you found this helpful .... if you have any questions send me a message