ASHISH KANAJARIYA0%Preparing your experience
Skip to content

WordPress Speculative Loading: How to Make Page Navigation Feel Instant

Speedometer gauge representing faster WordPress page loads with speculative loading

Most performance work focuses on making a single page load faster. You compress images, trim JavaScript and add caching, and every page gets a little quicker. WordPress speculative loading takes a different approach. Instead of only speeding up the page a visitor is on, it quietly prepares the page they are most likely to open next, so the navigation feels close to instant when they click.

Speculative loading has been part of WordPress core since version 6.8, and WordPress 7.1 added new ways for hosts and developers to configure it. In this guide I explain what speculative loading is, how WordPress uses the browser’s Speculation Rules API, which defaults ship with core, and how to tune the settings for your own site without creating extra load on your server.

What Is Speculative Loading?

Speculative loading means asking the browser to start loading a page before the visitor actually navigates to it. Modern browsers support this through the Speculation Rules API, a small JSON format that tells the browser which links are good candidates and how aggressively to act on them.

There are two main modes:

  • Prefetch downloads the HTML document of the next page and keeps it ready. When the visitor clicks, the browser already has the document and can skip the network round trip for it. Images, styles and scripts still load as normal.
  • Prerender goes further. The browser loads and renders the entire next page in a hidden background tab, including its scripts and images. When the visitor clicks, the prepared page is swapped in and appears almost immediately.

Prefetch is lighter and safer. Prerender delivers the most dramatic improvement, but it uses more bandwidth, memory and server resources because the whole page is processed in advance.

Eagerness: when the browser acts

The second setting is eagerness, which controls when the browser starts speculating:

EagernessWhen speculation startsTrade-off
ConservativeWhen the visitor presses down on a link (mouse down or touch start)Very few wasted requests, smaller head start
ModerateWhen the visitor hovers over a link for a short moment on desktopBigger head start, some speculations are never used
EagerEarlier still, with less certainty about the visitor’s intentLargest head start, most extra requests

The time between a pointer pressing down and the click completing is short, but it is often long enough to fetch a cached HTML document. That is why even the conservative setting produces a noticeable improvement on fast hosting.

How WordPress Speculative Loading Works in Core

The feature started life as the Speculative Loading plugin from the WordPress Performance Team and was merged into core in WordPress 6.8, released in April 2025. Since then, every WordPress site that meets the conditions below prints a speculation rules script on the front end automatically. You do not need to install anything to benefit from it.

The core defaults are deliberately cautious:

  • Mode: prefetch
  • Eagerness: conservative
  • Logged-in users: speculative loading is turned off, so editors and administrators never trigger it while working
  • Permalinks: it only runs on sites that use pretty permalinks
  • Excluded URLs: WordPress admin and login URLs and core asset paths are excluded, and links marked rel='nofollow' are skipped

These choices mean the feature is safe to enable for millions of sites at once. A conservative prefetch rarely loads a page the visitor did not want, and it never runs JavaScript for the next page in advance.

What changed in WordPress 7.1

WordPress 7.1, released on 19 August 2026, kept the same defaults but made them configurable at the hosting level. Two new settings can be defined either as environment variables or as constants in wp-config.php:

  • WP_SPECULATIVE_LOADING_DEFAULT_MODE accepts prefetch or prerender.
  • WP_SPECULATIVE_LOADING_DEFAULT_EAGERNESS accepts conservative, moderate or eager. The immediate value is not allowed as a site-wide default.

A constant takes priority over an environment variable with the same name, and any unrecognised value falls back to the core default. WordPress 7.1 also introduced the internal function wp_get_speculation_rules_default_configuration(), which resolves these defaults. If you want an overview of everything else in that release, my WordPress 7.1 features guide covers it in detail.

This change is especially helpful for managed hosts. A host with strong page caching can raise the default eagerness for every site on its platform, while each site owner can still override it.

Why Speculative Loading Matters for Core Web Vitals

Google’s Core Web Vitals measure real visitor experience, and two of them benefit directly from speculative loading. When a document is already prefetched, the browser does not wait for the server to respond, so Time to First Byte for that navigation drops close to zero. Because the first byte arrives sooner, Largest Contentful Paint usually improves as well.

With prerender, the effect is even larger. The page is already painted in the background, so LCP for the activated page can be almost immediate. That is a big win for content sites where readers move from article to article, and for online stores where shoppers browse category and product pages.

Laptop screen showing a PageSpeed Insights performance report

Speculative loading does not replace the fundamentals. It speeds up the next navigation, but the first page a visitor lands on still depends on your hosting, caching and front-end code. If your pages also feel slow to respond to clicks and taps, my guide to WordPress INP optimization covers the interaction side of Core Web Vitals.

How to Check Whether Speculative Loading Is Active

Before changing any settings, confirm what your site is doing today. It takes two minutes.

  1. Log out of WordPress, or open your site in a private browser window. Remember that core turns the feature off for logged-in users.
  2. View the page source and search for speculationrules. You should find a script tag of type speculationrules containing a JSON rule with the mode and eagerness.
  3. In Chrome or Edge, open DevTools, go to the Application panel and find Speculative loads under Background services. It lists the rules the browser found and every speculation it attempted.
  4. Hover over or press a link and watch the list update. Then click the link and check the Network panel to see the prefetched document being used.

If you do not see the script, check that pretty permalinks are enabled under Settings → Permalinks and that no plugin or custom code has switched the feature off.

How to Configure WordPress Speculative Loading

You have three ways to change the behaviour, from the simplest to the most flexible.

Option 1: Use the Speculative Loading plugin

The Performance Team still maintains the Speculative Loading plugin. It adds a settings section under Settings → Reading where you can choose the mode and eagerness without code. Several performance plugins also expose these settings in their own interfaces. This is the best option for site owners who prefer not to edit files.

Option 2: Set a default in wp-config.php (WordPress 7.1 and later)

If you manage the server yourself, you can raise the defaults with the new constants. Add them above the line that says That’s all, stop editing:

define( 'WP_SPECULATIVE_LOADING_DEFAULT_MODE', 'prefetch' );
define( 'WP_SPECULATIVE_LOADING_DEFAULT_EAGERNESS', 'moderate' );

This keeps the lightweight prefetch mode but starts speculating on hover, which gives the browser a much bigger head start. It is a good middle ground for sites with full-page caching.

Option 3: Use the filter in a plugin or theme

Developers can use the wp_speculation_rules_configuration filter, available since WordPress 6.8. A value set through this filter takes precedence over the default configuration:

add_filter( 'wp_speculation_rules_configuration', function ( $config ) {
    if ( ! is_array( $config ) ) {
        return $config;
    }
    $config['mode']      = 'prerender';
    $config['eagerness'] = 'moderate';
    return $config;
} );

The is_array() check matters. When speculative loading is unavailable, for example for logged-in users, the configuration is null, and your code should leave it that way.

Returning null from the same filter switches the feature off completely. That is useful on a staging site or while debugging:

add_filter( 'wp_speculation_rules_configuration', '__return_null' );

Excluding URLs That Should Never Be Speculated

Some pages should only load when a visitor really asks for them. Typical examples are cart and checkout pages, account areas, logout links, links that add a product to the cart, and any URL that changes data on the server. Prefetching them could create sessions or update state unexpectedly, and prerendering them could run scripts that assume the visitor is looking at the page.

WordPress provides the wp_speculation_rules_href_exclude_paths filter for this. Paths use the URL Pattern syntax, so an asterisk matches anything after it:

add_filter( 'wp_speculation_rules_href_exclude_paths', function ( $paths ) {
    $paths[] = '/cart/*';
    $paths[] = '/checkout/*';
    $paths[] = '/my-account/*';
    return $paths;
} );

Some plugins already add their own exclusions, so check the rules in DevTools before adding duplicates. Excluding a path twice does no harm, though, so when in doubt, add it.

Adding your own rules

For advanced cases, core also offers the wp_load_speculation_rules action. It passes a WP_Speculation_Rules object so a plugin can register additional rules, for example prerendering a single high-value landing page with eager timing while the rest of the site keeps the defaults. Most sites never need this, but it is a good tool for campaigns and product launches.

Choosing the Right Settings for Your Site

There is no single best configuration. The right choice depends on your hosting, caching and type of site. Here is how I approach it on client projects.

Blogs and content sites with page caching

Cached HTML is cheap to serve, so extra prefetch requests barely register on the server. Moving to moderate prefetch is usually a safe improvement. If your articles are light and your analytics handle prerendering correctly, moderate prerender can make reading the next article feel instant.

WooCommerce and membership sites

Stores have more pages that should not be speculated, and uncached pages are more expensive to build. I keep prefetch mode, add explicit exclusions for cart, checkout and account URLs, and only raise eagerness once page caching is confirmed to work for product and category pages.

Sites on small or shared hosting

Here the core default of conservative prefetch is a sensible choice. Every speculation is still a real request, and if pages are not cached, each one asks PHP and the database to build a page. Improve caching first, then revisit eagerness. A persistent object cache also helps by making uncached pages cheaper, which I cover in my WordPress Redis object cache guide.

Things to Test Before Raising Eagerness

Speculative loading is safe by design, but a few areas deserve a quick check whenever you move beyond the defaults:

  • Analytics: confirm that your analytics only count a page view when the page is actually shown, not when it is prerendered in the background. Compare page view numbers for a week before and after the change.
  • Server load: watch CPU, PHP workers and bandwidth for a few days. A small increase in requests is expected; a large one usually means uncached pages are being speculated.
  • Personalised content: pages that show a visitor-specific greeting, cart count or recently viewed items should still be correct after activation.
  • Third-party scripts: chat widgets, popups and ad scripts that run on load should behave correctly when a prerendered page becomes visible.
  • Caching plugins: some caching and optimisation plugins add their own preload or speculation features. Use one approach at a time so the rules are easy to understand.

For a full picture of how caching, images and scripts work together, my walkthrough on cutting load time from 12 seconds to 2 seconds shows the order I usually work in.

Browser Support

The Speculation Rules API is supported in Chromium-based browsers such as Chrome and Edge, which together account for a large share of web traffic. Other browsers simply ignore the rules and load pages normally, so there is no downside for their visitors. This makes speculative loading a progressive enhancement: supported browsers get faster navigations, and everyone else gets the same experience as before. Google’s guide to prerendering pages in Chrome is a helpful reference if you want to go deeper.

Common Questions About WordPress Speculative Loading

Does speculative loading replace a caching plugin?

No. Caching makes each page cheaper and faster to deliver, while speculative loading starts that delivery earlier. They work best together, and speculative loading gives the biggest benefit on sites that already serve cached pages.

Will it affect my SEO?

Speculation happens in the visitor’s browser and does not change your HTML content, URLs or structured data. Its main SEO effect is indirect: faster navigations can improve the real-user Core Web Vitals data that Google collects.

Why do I not see it while logged in?

WordPress turns the feature off for logged-in users on purpose, so dashboard links and editing screens are never loaded in advance. Test in a private window instead.

Is prerender always better than prefetch?

Prerender gives a faster result when the visitor follows the link, but it costs more when they do not. On heavy pages or busy servers, moderate prefetch is often the better balance. Measure both and keep the one that improves your real-user data without stretching your hosting.

Final Thoughts

WordPress speculative loading is one of those rare features that improves speed for almost every site without any setup. The core defaults are careful and reliable, and WordPress 7.1 makes it easier than ever to tune them for your hosting environment. Start by confirming the feature is active, add exclusions for pages that change data, then experiment with moderate eagerness once your page caching is solid. Small, measured changes like these add up to a site that feels fast from the first click to the last.

If you are working through other parts of site performance, you may also find my guides on WordPress cron jobs and WooCommerce HPOS useful.

Images: photos by Chris Liverani and Justin Morgan on Unsplash.

Leave a Reply

Your email address will not be published. Required fields are marked *