Your browser is good at loading pages, but it’s also lazy. It discovers most resources — fonts, scripts, images from other domains — by reading your HTML and CSS, one step at a time. Resource hints are your way of saying, “Trust me, you’re going to need this soon — start working on it now.”
Used well, they shave meaningful time off loads, especially on pages with third-party resources. Used badly, they waste bandwidth and mobile data — and can actually slow your site down. This guide explains each hint, when it genuinely helps on WordPress, and how to add them.
What Resource Hints Actually Are
A resource hint is a small <link> tag in your page’s <head> declaring your intent: a relationship between the current page and some resource the browser will likely need. Four main ones:
- dns-prefetch — resolve the domain name early
- preconnect — resolve the domain, open the connection, and complete the TLS handshake early
- preload — download a critical resource early, with high priority
- prefetch — download a resource needed for the next page, with low priority
Each one moves a different step of the loading process earlier. The trick is knowing which step is actually the bottleneck for your site — and the payoff is real on typical WordPress setups, where fonts come from Google, analytics from another domain, and images from a CDN, each requiring its own DNS lookup and connection handshake before a single byte moves.
DNS-Prefetch: The Cheap Win
A DNS prefetch hint tells the browser: “You’ll need this domain soon — look up the address now, while you’re busy with other things.”
<link rel="dns-prefetch" href="https://fonts.googleapis.com">
<link rel="dns-prefetch" href="https://www.google-analytics.com">
When it helps: pages that load resources from several third-party domains. This is extremely common on WordPress — themes and plugins love pulling in outside scripts.
When it’s pointless: hinting at domains that matter late in the page. There’s no benefit to prefetching the DNS of a domain whose script loads five seconds in — the browser will have resolved it naturally by then anyway.
WordPress angle: WordPress core has a built-in mechanism called wp_resource_hints that themes and plugins use to register hints. That’s also why you sometimes see mystery <link rel="dns-prefetch"> tags in your source — a plugin added them. View your page source and search for dns-prefetch and preconnect; you’ll often find stale hints for services you removed months ago.
Preconnect: DNS-Prefetch With Muscle
Preconnect goes two steps further. It doesn’t just resolve the domain — it opens the TCP connection and completes the TLS handshake ahead of time, so the transfer starts immediately when the browser needs the file.
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Notice the crossorigin attribute. For resources fetched with CORS — like fonts — you need crossorigin, or the preconnect won’t match the actual request and the browser will open a second connection anyway. This is one of the most common preconnect mistakes, and it’s invisible unless you look for it.
When it helps: for one or two truly critical origins — your CDN domain, or the font files’ domain. Note that Google fonts come from fonts.gstatic.com, not fonts.googleapis.com — the stylesheet and the files live on different domains, and a surprising number of tutorials preconnect to the wrong one.
When it hurts: preconnecting to five or six domains. Opening connections costs CPU and network resources on both ends, and browsers cap how many sockets they keep warm. Limit preconnects to one or two critical origins.
Rule of thumb: preconnect for the critical origins, dns-prefetch for the rest. Already preconnecting to a domain? Skip its dns-prefetch — the preconnect includes the DNS step.
Preload: The One That Demands Respect
Preload is the most powerful and most dangerous hint: “Download this file right now, with high priority, because the page will definitely need it.” Unlike the other hints, preload fetches the actual resource — and the browser trusts you completely.
<link rel="preload" href="/wp-content/themes/your-theme/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>
The as attribute is mandatory, and this is where most people trip up. It tells the browser the resource type (font, script, style, image), which determines request priority, CORS mode, and duplicate-fetch protection. Get as wrong and the browser may download the file twice. For fonts, you also need crossorigin — fonts are always fetched with CORS, so a preload without it gets downloaded twice.
When it helps — the short list of things worth preloading:
- Your LCP image, if it’s not already discovered early. PageSpeed Insights will literally tell you “Preload LCP image” when this applies. If your hero image is defined in CSS or loaded by a slider plugin, the browser can’t see it early — a preload fixes that.
- Key font files — not the CSS that references them, the actual
.woff2files. There’s a dedicated walkthrough of the font-preloading angle in our guide to preloading fonts in WordPress. - Critical above-the-fold CSS, if you’re inlining it (inline the critical CSS, preload the rest — don’t do both to the same file).
When it hurts — preloading the wrong things is worse than preloading nothing:
- Preloading resources that end up unused triggers a console warning and wastes bandwidth on every visit.
- Preloads steal bandwidth from other critical resources. Preloading five files means five other things wait.
- Preloading a resource the browser would have discovered in the HTML anyway (like a stylesheet in the head) adds bytes to your markup and saves nothing.
WordPress note: unlike dns-prefetch and preconnect, preload isn’t something WordPress core manages for you — plugins like Perfmatters, WP Rocket (font preloading), and OMGF expose it in settings, or you can add it manually with a condition so it only fires where needed. Preloading your homepage’s hero image on every blog post is classic preload bloat.
Prefetch: Betting on the Next Click
Prefetch is fundamentally different from the other three. It downloads a resource the browser will need for the next navigation — a page the visitor hasn’t opened yet — at the lowest priority, using only idle network time.
<link rel="prefetch" href="/pricing/">
When it helps: when the next step is genuinely predictable. A checkout flow, a “step 2 of 4” form, the single post template after an archive page. If most visitors to your pricing page head to checkout next, prefetching the checkout page’s key assets makes that navigation feel instant.
When it hurts — and this is the bigger story on WordPress:
- Blog visitors are unpredictable. Prefetching resources for the “next” post on a blog where readers might leave or click anywhere is gambling with their bandwidth.
- On mobile, prefetch burns through data plans — browsers stay conservative under data-saver conditions for this reason.
- If the current page is still loading, prefetches queue behind it — correct behavior, but they often accomplish nothing.
The modern alternative: WordPress 6.8+ ships with the Speculation Rules API — prerender and prefetch based on actual user signals like hovering over a link, rather than blind prefetching. Same judgment applies: enable it for high-probability navigations (pricing-to-checkout, the “next lesson” button), not site-wide on a blog where every click is a coin flip.
What WordPress Already Does For You (And What It Doesn’t)
WordPress core does use resource hints quietly. The wp_resource_hints() function outputs dns-prefetch and preconnect hints that themes and plugins register — typically for external script and style dependencies.
What WordPress does not do for you:
- It won’t preload your LCP image, because it can’t know which image that is.
- It won’t preconnect to your CDN domain, because it doesn’t know your CDN.
- It won’t prefetch anything, because it doesn’t predict navigation.
That last part is good design. Hints are site-specific decisions, and a CMS can’t make them for you. When you install a performance plugin, check its resource hints settings before adding your own — double preconnects to the same domain are a common source of hint bloat.
A Worked Example: Putting It Together
The site: a small business site with Google Fonts, Google Analytics 4, and images on a CDN subdomain.
Fonts: the stylesheet comes from fonts.googleapis.com, the files from fonts.gstatic.com. So: preconnect to fonts.gstatic.com with crossorigin, dns-prefetch fonts.googleapis.com, and preload the .woff2 files with as="font".
CDN: every image comes from the CDN subdomain — a critical origin, so preconnect it. If the hero image is your LCP element, add a preload with as="image".
Analytics: the GA script isn’t render-blocking and feeds no Core Web Vital. A dns-prefetch is plenty — preconnecting to analytics is textbook over-hinting.
Same-origin scripts (the contact form, theme JS) need no hints at all — no DNS lookup, no new connection. Adding preconnects to your own domain is a no-op.
Final tally: two preconnects, three preloads, two dns-prefetches. Everything else gets nothing. If your hint list is longer than this for a simple site, something’s off.
How to Add Resource Hints in WordPress
Option 1: Let your performance plugin do it. Perfmatters has dedicated preconnect, preload, and prefetch settings; WP Rocket preloads fonts. Start there — manual hints on top of plugin hints are how duplicates happen. If you’re still choosing caching tooling, our render-blocking resources guide covers the defer/delay side of the same scripts.
Option 2: A few lines in your child theme or a code-snippets plugin. WordPress’s wp_resource_hints filter handles dns-prefetch and preconnect cleanly:
add_filter( 'wp_resource_hints', function( $urls, $relation_type ) {
if ( 'preconnect' === $relation_type ) {
$urls[] = 'https://cdn.yourdomain.com';
}
if ( 'dns-prefetch' === $relation_type ) {
$urls[] = 'https://www.google-analytics.com';
}
return $urls;
}, 10, 2 );
For preload, add a <link> in wp_head with a conditional so it only fires where the resource matters:
add_action( 'wp_head', function() {
if ( is_front_page() ) {
echo '<link rel="preload" href="/wp-content/uploads/hero-image.webp" as="image" fetchpriority="high">';
}
}, 1 );
Option 3: Server-level. You can send hints as HTTP Link headers — the fastest delivery method since it doesn’t wait for HTML parsing, but the hardest to manage per-page. Most WordPress sites should start with in-markup hints.
If your CDN is the origin you’re preconnecting to, make sure it’s actually configured first — hints can’t fix a CDN that isn’t serving your assets. Our CDN setup walkthrough covers that step by step.
How to Verify Your Hints Actually Work
- DevTools → Network → timing. Preconnects show as early connection setup; preloaded resources show high priority; prefetched ones show lowest priority after the page’s own resources.
- Console warnings. Chrome warns when a preloaded resource wasn’t used within seconds of load. Treat that as a to-do item — remove the hint or fix the condition.
- PageSpeed Insights, before and after. Add one hint at a time and re-test. Hints interact with your caching setup; the only honest measurement is a controlled comparison on the same page — one variable at a time.
Common Mistakes to Avoid
- Preconnecting to half the internet. One or two origins; the rest get dns-prefetch at most.
- Forgetting
crossoriginon font preconnects and preloads. Causes silent double downloads. - Preloading the stylesheet instead of the font. Preload the
.woff2itself, not the CSS that references it. - Preloading assets already in the HTML. A normal
<img>in the first viewport is found by the browser’s preload scanner on its own. - Prefetching where the next click is unpredictable. Save prefetch for funnels.
- Never re-checking. Themes change and plugins come and go; stale hints just slow down your
<head>.
The Bottom Line
Resource hints are not a performance strategy on their own — they’re the finishing touches on a site that’s already in good shape. Preconnect your one or two critical origins, preload your LCP image and key fonts if they’re discovered late, prefetch only when the next navigation is predictable. Then verify in DevTools, one hint at a time, and delete anything that doesn’t move the numbers.
One comment on “Resource Hints in WordPress: Preload, Preconnect, Prefetch and DNS-Prefetch Explained”