Warp‑Speed WordPress: Speculative Loading Arrived in Core 6.8
TL;DR - Chrome can now predict the link your visitor will click and load the next page before they do. WordPress 6.8 enables this by default for anonymous traffic.
What is speculative loading?
Imagine WordPress sprouting a tiny crystal ball. When a visitor hovers or touches an internal link, the browser receives a JSON rule instructing it to prefetch (or even prerender) that page in the background. If the user follows through with the click, the response is already waiting in cache, navigation latency drops toward 0 ms.
Why you should care
- +1.9 % median LCP pass‑rate across 50 k pilot sites.
- 8 % of all Chrome navigations already rely on Speculation Rules.
- No theme changes, no JavaScript bundles, just one small
<script>emitted by Core.
Default behaviour in WordPress 6.8
| Condition | State |
|---|---|
| Visitor not logged‑in & Pretty Permalinks | ✅ Enabled |
Logged‑in user / Plain permalinks / Query vars (?add-to-cart=) | ❌ Disabled |
The config shipped in Core is mode: "prefetch" and eagerness: "conservative", fast enough to matter, thrifty enough to avoid wasting bandwidth.
One‑liner to go prerender
<?php
/**
* Enable speculative prerender with moderate eagerness.
*
* @param array $config Default configuration.
* @return array Filtered configuration.
*/
add_filter(
'wp_speculation_rules_configuration',
static function ( array $config ) : array {
$config['mode'] = 'prerender';
$config['eagerness'] = 'moderate';
return $config;
}
);
How does it work?
- WordPress injects a
<script id="wp-speculation-rules">tag - On user gesture, the script adds a document‑level rule:
{ "eagerness":"conservative", "mode":"prefetch", "hrefPrefix":"https://example.com/" } - Chromium parses the rule and starts a hidden fetch (or full prerender)
- The navigation reuses that response, arriving effectively instant
Keeping WooCommerce carts safe
But what about WooCommerce carts? Those URLs are dynamic, and you don't want to prerender them. So, you can exclude them with a simple filter:
<?php
/**
* Exclude sensitive endpoints from speculation rules.
*/
add_filter(
'wp_speculation_rules_href_exclude_paths',
static function ( array $paths ) : array {
$paths[] = '/cart/*';
$paths[] = '/checkout/*';
return $paths;
}
);
The defaults already skip any URL with query vars (e.g. ?add-to-cart=), but explicit wildcards keep you future‑proof. But you get the idea!
No‑code control for editors
- Add class
no-prefetchto a block → disables speculative loading inside. - Add class
moderate-prerender(or whatever you configure) → forces faster prerender.
Gotchas & best practices
- Analytics: prerender triggers full page scripts. Use conservative mode if duplicate events hurt your metrics.
- Side‑effects: avoid
GETendpoints that change state without query vars. - Safari / Firefox: they’ll just ignore the rule, so measure performance with a Chrome‑only cohort.
Conclusion
Speculative loading turns WordPress into WarpPress with almost no effort. Upgrade to 6.8 and sprinkle a couple of filters to delight your visitors, and your Core Web Vitals.
Happy caching, and may your clicks always be fast!