🚀 Available from WP Rocket 3.6
It is found on the Preload tab:
In this Article
How to use Preload Fonts
The Preload Fonts option allows you to tell the browser to start downloading fonts that it otherwise wouldn't discover until much later. This is usually because the font is referenced from within a CSS file.
Preloading fonts will improve load time and perceived performance.
HEADS UP: To improve the Largest Contentful Paint metric, Preloading Fonts will be disabled automatically on pages where Optimize CSS Delivery is active
Which fonts should I preload?
Google PageSpeed Insights will point out any fonts that could benefit from this optimization under the Opportunity, Preload Key Requests:
TIP: Bypass WP Rocket when running a PageSpeed test to discover candidates for font preloading.
- Right-click on the recommended font in PageSpeed and copy the URL
- Paste the URL into the "Fonts to Preload" field.
- The font must be hosted on your own domain, or your CDN's domain. You cannot enter externally hosted fonts like Google Fonts here - those are optimized automatically: Optimize Google Fonts
- The font URL must match exactly what PageSpeed provides.
Don't preload everything!
Preload should be used sparingly to avoid creating a bottleneck. Only preload fonts which would otherwise delay the rendering of the page or the perceived performance. If you preload too many fonts which are not needed right away, you will decrease the performance of your site.
Preloading in action
When you enter a font URL for preloading, WP Rocket will apply the preload tag as follows, in the <head> of your site:
<link rel="preload" as="font" href="https://example.com/wp-content/themes/paperback/inc/fontawesome/fonts/fontawesome-webfont.woff2" crossorigin><br>
This optimization will be applied on both cached and uncached pages.
With preloading, you will see the font being requested earlier in the waterfall and it should improve load time and the first paint time.
Waterfall before font preload
Note that the fonts are requested about halfway down, as the browser naturally discovers them.
Waterfall with font preloading
The fonts are now requested at the top, improving performance.
Warnings: Lighthouse was unable to automatically check the `font-display` value for the origin
This is usually caused by preloading fonts that should not be preloaded. You can verify that in Chrome because it will show a warning like this in the console: