Preload key requests – link rel=preload
-
Hello,
I would like to ask you how to resolve this issue from Google PageSpeed:
Consider using <link rel=preload>
to prioritize fetching resources that are currently requested later in page load:
…fonts/woodmart-font.woff
Thanks.
Attachments:
You must be
logged in to view attached files.
Hello,
Thank you so much for contacting our support center.
This file is loaded via CSS and not using <link
tag. Sorry, but it is not possible to add such an attribute there.
Kind Regards
XTemos Studio
@harton
The following snippet has helped me:
// Preload fonts for mobile theme
function dns_prefetch_mobile() {
echo "<link href='https://yourURL.test/wp-content/themes/woodmart/fonts/woodmart-font.woff?v=5.2.0' rel='preload' as='font' type='font/woff' crossorigin='anonymous'>";
}
add_action( 'wp_head', 'dns_prefetch_mobile', 0 );