Speed & performance · Guide
How to Use a Speculation Rules API in WordPress
Short answer
In WordPress 6.8 and later, speculative loading is already on for logged-out visitors on sites with pretty permalinks, using prefetch with conservative eagerness. You use the Speculation Rules API by checking that default in your page source, then changing the mode and eagerness with the wp_speculation_rules_configuration filter or the official Speculative Loading plugin.
Key takeaways
- WordPress 6.8 and later prefetches pages for logged-out visitors on sites with pretty permalinks, as of November 2026.
- Prefetch downloads only the next page HTML, while prerender loads and renders the full page in a hidden tab.
- The official Speculative Loading plugin defaults to prerender with moderate eagerness and adds a Settings > Reading screen.
- Chrome, Edge, and Opera from version 121 support the features WordPress uses, while other browsers ignore the rules.
- Never prefetch or prerender cart, checkout, logout, account, or other pages that change state or show private data.
- Prerendered pages can fire analytics early, so check how your tracking handles a page that loads before it is seen.
What is the Speculation Rules API in WordPress?
The Speculation Rules API is a browser feature that lets WordPress tell the browser which pages a visitor is likely to open next, so the browser can start loading them early.
WordPress writes the rules as a JSON block in a script tag with the type speculationrules. A browser that supports the API reads that block and starts the work. A browser that does not support it ignores the block and loads pages in the normal way.
The API covers full page navigation, from one HTML page to another. It is not a general tool for loading images, fonts, or script files early. Those files still need their own loading controls.
Chrome describes speculation rules as JSON instructions that name URLs to prerender, and it notes that the rules can use a list of URLs or a document rule that matches links on the page (Prerender pages in Chrome).
What does WordPress do by default in version 6.8?
WordPress 6.8, released in April 2025, turns on speculative loading by default for logged-out visitors on sites with pretty permalinks.
The default is prefetch with conservative eagerness. That means the browser starts to fetch the next page when the visitor starts to click a link. It does not start on page load, and it does not render the page in advance.
Make WordPress Core states that the feature was used on over 50,000 WordPress sites through the Speculative Loading feature plugin before it was merged into WordPress 6.8 (Speculative Loading in 6.8). The core version keeps the safer default, while the plugin uses a faster one.
The default does not apply in 3 cases:
- The visitor is logged in.
- The site uses plain permalinks, such as
/?p=123. - The page is in the admin area.
If you want a faster site overall, start by learning how to speed up WordPress before you change speculation settings.
How is prefetch different from prerender?
Prefetch downloads only the HTML of the next page, while prerender fetches, renders, and runs the full page in a hidden tab.
Prefetch is the lighter choice. The browser stores the HTML, then still needs to fetch images, styles, and scripts and render the page after the click. It saves the server round trip for the document, which is often the slowest part of a cold navigation.
Prerender is the faster choice for the visitor. When the visitor clicks, Chrome swaps the hidden tab into view, so the page can appear almost at once. The cost is higher: the browser uses more memory, bandwidth, and CPU for a page the visitor may never open.
| Action | What the browser does | Cost | Best use |
|---|---|---|---|
| Prefetch | Downloads the next page HTML only | Low | Most WordPress blogs and content sites |
| Prerender | Loads and renders the full page, with scripts and images | High | Pages visitors open often, such as a product page from a shop listing |
| Prerender until script | Renders the page but pauses at a blocking script | Medium | A newer Chrome option in an origin trial from Chrome 144, not a WordPress default |
Chrome notes that prerender until script is a middle option between prefetch and prerender, and that it was in an origin trial from Chrome 144 (Prerender until script origin trial). Do not plan a WordPress setup around it yet.
What do the eagerness settings mean?
Eagerness sets when the browser starts the speculative load, from at once to only when the visitor starts to click.
Chrome lists 4 eagerness values: immediate, eager, moderate, and conservative.
immediatestarts as soon as the rules are read.eagerstarts early, after a short signal.moderatestarts on hover or a similar interaction.conservativewaits until the visitor starts to click.
WordPress core uses conservative eagerness by default. The official plugin uses moderate eagerness by default, so loading starts when a visitor interacts with a link.
Choose eagerness by how sure you are about the next click:
- Use conservative prefetch for normal blog links and menus.
- Use moderate prerender for a next step that most visitors take, such as a product page from a category page.
- Use eager or immediate only for a small set of pages where the next click is almost certain, such as the next page in a checkout flow that does not change state.
How do you check if speculative loading is working on your site?
Open a public page in a private browser window while logged out, view the page source, and search for speculationrules.
Follow these steps, which take about 5 minutes:
- Update WordPress to version 6.8 or later in Dashboard > Updates.
- Set pretty permalinks in Settings > Permalinks, using Post name or another structure that is not Plain.
- Log out, or open a private window, then open a public post or page.
- View the page source and search for
speculationrules. - Check that the JSON block lists prefetch with conservative eagerness.
If you see no block, check the 3 common causes first: you are still logged in, the site uses plain permalinks, or a plugin or host cache is serving an old page. Clear the cache and test again in a private window.
Chrome DevTools can also show the rules. Open DevTools, go to Application > Preloading, and look at the Speculation Rules and Preloads lists (What is new in DevTools, Chrome 117). A listed URL with a success status means Chrome accepted the rule.
How do you change the mode and eagerness with code?
Use the wp_speculation_rules_configuration filter in a child theme or a small custom plugin, and return a mode and an eagerness value.
You need WordPress 6.8 or later, pretty permalinks, and a way to add PHP without editing a parent theme. A child theme functions file or a code snippets plugin is the safer place. Back up the site before you edit PHP.
This example switches the site to prerender with moderate eagerness:
add_filter( 'wp_speculation_rules_configuration', function( $config ) {
if ( ! is_array( $config ) ) {
return $config;
}
$config['mode'] = 'prerender';
$config['eagerness'] = 'moderate';
return $config;
} );
The filter receives an array with mode and eagerness keys, or null when speculative loading is off for that request. Make WordPress Core notes that returning null from the filter turns the feature off (Speculative Loading in 6.8).
To exclude a path, use the wp_speculation_rules_href_exclude_paths filter and add the path pattern, such as /cart/* or /account/*. Test the change in a private window, then check the page source again to confirm the new mode and eagerness appear.
How do you use the Speculative Loading plugin instead?
Install the official Speculative Loading plugin if you want a settings screen instead of code, or if your site runs WordPress older than 6.8.
The plugin was formerly called Speculation Rules. It is from the WordPress Performance Team, and its defaults are prerender with moderate eagerness, which is faster and less cautious than the WordPress core default.
Follow these steps:
- Go to Plugins > Add New in the WordPress admin.
- Search for Speculative Loading.
- Install and activate the plugin.
- Go to Settings > Reading.
- Find the Speculative Loading section and pick a mode and an eagerness value.
- Save the settings, clear any cache, and test in a private window.
The plugin page states that the Speculation Rules API features it uses are supported in Chromium-based browsers such as Chrome, Edge, or Opera using version 121 or above (Speculative Loading). Other browsers ignore the rules and load pages in the normal way.
The plugin also offers an opt-in for logged-in users in version 1.6.0. Leave that off unless your server can handle the extra load, because logged-in pages are often uncached and personal.
Which pages should you never prefetch or prerender?
Never prefetch or prerender a page that changes state, charges money, logs a visitor out, or shows private data.
WordPress core already excludes admin pages and URLs with query strings by default. You still need to exclude your own risky paths, because a shop or membership plugin may use clean URLs for actions that change state.
Exclude these types of pages:
- Cart, checkout, and payment pages
- Logout and password reset links
- Account, order history, and member-only pages
- Add-to-cart, favourite, vote, and other action links
- Search results and filtered pages with query strings
- Any page that sends an email, creates a record, or runs a form on load
A prerendered page can run scripts before the visitor sees it. That can fire an analytics event, count a view, or start a session for a page the visitor never opened. Prefetch is safer here, because it downloads HTML only and does not run scripts.
If you run a shop, read how to pass Core Web Vitals in WordPress and check your checkout flow after any change to speculation settings.
What results can you expect, and how do you check them?
Expect a faster next-page load in Chrome, not a faster first page load, and check the change in field data rather than in a single lab test.
Speculation rules do not speed up the page a visitor is already reading. They speed up the next navigation, because part or all of that work is already done. A lab tool that loads one page cold will not show the gain.
A published web.dev case study shows what prerender can do on a shop. Ray-Ban prerendered product pages and cut mobile LCP from 4.69 seconds to 2.66 seconds, a 43% fall, and desktop LCP from 3.03 seconds to 1.74 seconds (Ray-Ban case study).
Mobile conversion rose by 101.47%. The exit rate fell by 13.25% on mobile and 13.18% on desktop.
Those are one shop's results, not a promise for a blog. Make WordPress Core reported a smaller, site-wide effect: about a 1.9% median lift in the LCP passing rate for sites that enabled speculative loading through the feature plugin.
Check your own site in this order:
- Confirm the rules appear in the page source for logged-out visitors.
- Check Application > Preloading in Chrome DevTools for accepted preloads.
- Watch your analytics for extra page views after you switch to prerender.
- Wait for field data in PageSpeed Insights or Search Console, which reflects real Chrome users over time.
For context on what a good load time looks like, see how fast a WordPress site should load.
Page speed also affects search visibility, as explained in does page speed affect SEO.
What mistakes should you avoid?
The main mistake is to turn on aggressive prerender for every link, then learn that analytics, server load, or a state-changing page broke first.
Avoid these 5 mistakes:
- Prerendering cart, checkout, logout, or account pages, which can trigger actions or show private data.
- Using immediate eagerness site-wide, which wastes bandwidth and server resources on pages nobody opens.
- Judging the change with a single lab test, which loads pages cold and cannot show a prerender gain.
- Forgetting that logged-in admins will not see the rules, then reporting that the feature is broken.
- Adding a second prefetch plugin on top of WordPress core and the Speculative Loading plugin, which can duplicate the work.
Start with the WordPress core default, which is prefetch with conservative eagerness. Move to moderate prerender only for a small set of high-traffic, public pages, and only after you have excluded risky paths and checked analytics. If your host struggles with extra load, check does hosting affect WordPress speed before you raise eagerness.
Frequently asked questions
Is speculative loading already on in WordPress?
Yes, if you run WordPress 6.8 or later, use pretty permalinks, and the visitor is logged out. The default is prefetch with conservative eagerness, so loading starts when the visitor begins to click. Admin pages and logged-in visitors do not get the default rules.
Does the Speculation Rules API work in Firefox or Safari?
No, not in the same way as in Chrome. The features WordPress uses are supported in Chromium-based browsers such as Chrome, Edge, and Opera from version 121. Firefox and Safari ignore the speculation rules script, so visitors on those browsers load pages in the normal way.
Will speculation rules help my Google ranking?
Google has not said that speculation rules are a ranking signal. They can improve real-user speed data, such as LCP for the next navigation, and that field data feeds the Core Web Vitals report. Treat the gain as a speed and user experience gain, not as a direct ranking change.
Why can I not see speculation rules while I am logged in?
WordPress disables the default rules for logged-in users, because their pages are often uncached and personal. Log out or use a private browser window to test the public site. The official plugin offers an opt-in for logged-in users, but you should only use it if your server can handle the extra load.
Can prerendering inflate my analytics?
Yes, it can. A prerendered page may run scripts and fire a page view before the visitor actually opens it. Check whether your analytics tool waits for activation before it counts a view, and watch for a rise in page views that does not match a rise in real visits after you switch to prerender.
Should I use the plugin or the WordPress core default?
Stay with the core default if you want the safest setup, which is prefetch with conservative eagerness. Use the official Speculative Loading plugin if you want prerender with moderate eagerness and a Settings > Reading screen, or if your site runs a WordPress version older than 6.8.
Sources
- Prerender pages in Chrome for instant page navigations Chrome for Developers
- Improve next page load performance Chrome for Developers
- Speculative Loading in 6.8 Make WordPress Core
- Speculative Loading WordPress.org
- How Ray-Ban doubled conversion rate and reduced exit rate by 13% through prerendering web.dev
- Speculation Rules API MDN Web Docs
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
