Resource Hints in WordPress: preload, preconnect and dns-prefetch explained
When you open a PageSpeed report and see the recommendation “Preconnect to required origins” or “Preload key requests”, you have landed on exactly the topic of this guide. Preload and preconnect WordPress are two techniques that tell the browser ahead of time which resources it is about to use, so it does not waste precious moments discovering them only when it gets there. Together with dns-prefetch, they form the “resource hints” family: small instructions placed in the <head> with a very real effect on speed.
What resource hints are and why they matter
A browser loads a page step by step. It reads the HTML, discovers CSS files, fonts, images and scripts along the way, then requests them one by one from the server. Every resource discovered late is a moment when the browser waits instead of working.
Resource hints flip that logic. Instead of letting the browser discover everything on its own, you give it a hint up front: “you will need this font” or “you will connect to that domain”. The result is a shorter loading waterfall and a better LCP (Largest Contentful Paint), which is exactly the metric Google tracks in Core Web Vitals.
dns-prefetch: the cheapest hint
Before the browser can download anything from another domain, it has to find that domain’s IP address through a DNS lookup. This translation usually takes between 20 and 120 milliseconds, invisible to you but real for the visitor.
With dns-prefetch you resolve DNS early, in parallel with the rest of the page:
<link rel="dns-prefetch" href="//fonts.gstatic.com">
It fits domains you load something from, but not necessarily right away: font networks, an analytics pixel, an image CDN. The cost is minimal, so you can use it for several domains without worry.
preconnect: the full connection, ready in advance
preconnect goes one step further. It does not just resolve DNS, it opens the entire connection: DNS + TCP handshake + TLS negotiation. In practice, by the time the browser actually needs the resource, the “door” is already open and the transfer starts almost instantly.
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Because an unused open connection consumes resources, use preconnect only for 2-3 truly critical domains, typically the domain that serves the fonts shown immediately. For fonts, always add the crossorigin attribute, otherwise the prepared connection will not be reused.
preload and preconnect WordPress: when to use each
Here is the key difference. preconnect prepares a connection to a domain; preload actually downloads a specific file, at high priority, even if it appears lower in the page.
<link rel="preload" href="/wp-content/themes/theme/font.woff2" as="font" type="font/woff2" crossorigin>
The as attribute is mandatory: it tells the browser what kind of resource it is, so it can prioritize it correctly. preload is ideal for your main font, the hero image (LCP) or a critical CSS file. The simple rule: preconnect = domain, preload = a concrete file you will definitely use.
How to add them in WordPress
You have several paths, depending on how much control you want:
- From the theme (recommended): place the hints in
header.phpor through thewp_headhook, so you control exactly what and when you preload. - With the
wp_resource_hintsfilter: WordPress offers a native API for dns-prefetch and preconnect, easy to extend programmatically. - From a cache plugin: LiteSpeed Cache and others have preconnect and font-preload options right in the interface, no code needed.
Whatever the method, a badly placed preload can hurt overall optimization, so treat it as part of a broader WordPress speed optimization strategy, not an isolated trick.
Common mistakes and how to avoid them
The most frequent one is overuse. If you preload ten files, none of them is truly a priority anymore: you have simply moved the traffic jam elsewhere. Preload only 2-3 resources with a real impact on the first render.
The second mistake: preload without the correct as or without crossorigin on fonts. In that case the browser downloads the file twice and you lose the whole benefit. Always check the browser console for “preloaded but not used” warnings.
You can read more about correct usage in the web.dev guide on preload, a solid source straight from the Chrome team.
Conclusion
Resource hints are not a magic button, but they are among the cheapest speed wins in WordPress: a few lines in the <head> that shorten connection and render time. Start with a preconnect to your font domain and a preload for your main font and hero image, then measure the difference. If you want to know exactly what is worth preloading on your site and where you lose milliseconds, ask us for a free audit and we will show you concretely, on your own report.


