How to Preload Font in WordPress Functional Plugin

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>
add_action('wp_head', 'tmm_add_to_header');

That’s it!

Thanks to for the font preload code.

Posted in

Toby Cryns

Toby Cryns is a freelance CTO, expert WordPress consultant, and teacher.

He offers free advice to improve your freelance biz.

He also publishes small droppings every now and then to and

Follow Toby's contributions on Github and