I use a plugin to do a bunch of optimizations on this site, but for some reason, the preloading of fonts is broken. So I rolled my own font preloading function and placed it in my functional plugin (You could also put it in functions.php). Here’s the code:
// Add code to <head>
function tmm_add_to_header(){
?>
<link rel="preload" href="/path/to/font.woff2" as="font" type="font/woff2" crossorigin>
<?php
};
add_action('wp_head', 'tmm_add_to_header');
That’s it!
Thanks to web.dev for the font preload code.
Posted in Blog Post