With the upcoming version 6.8, WordPress is introducing a new performance improvement: speculative loading. This function uses modern browser APIs to load page content in the background - before a user actively clicks on a link. The aim is to significantly reduce the perceived loading time.
What does "speculative loading" mean?
With speculative loading, content that is highly likely to be accessed next is preloaded in the background. This happens even before the user performs an action such as clicking on a link. The basis for this is the Speculation Rules API, which is currently supported by browsers such as Chrome, Edge and Opera.
In practice, this means that when a user moves the mouse pointer over a link or shows a certain scrolling behavior, the browser starts loading the linked page - which ideally leads to almost instantaneous page changes.
Implementation in WordPress 6.8
WordPress 6.8 integrates this function by default under the following conditions:
- The site uses Pretty Permalinks
- The user is not logged in
- The browser used supports the Speculation Rules API
The function is therefore primarily aimed at website visitors, not administrators or logged-in member areas.
What are "pretty permalinks"?
"Pretty permalinks" are user-friendly, readable URLs such as www.beispielseite.de/kontakt instead of technical URL formats such as www.beispielseite.de/?page_id=123. This permalink structure is not only more visually appealing, but also improves search engine friendliness. The setting is made in WordPress under Settings → Permalinks → Post name. If you want to learn more about permalinks, check out my post on this topic here to.
Advantages for the user experience
The following improvements in particular can be achieved by introducing speculative loading:
- Accelerated page transitions through preloading in the background
- Improved Core Web Vitals, especially for Largest Contentful Paint (LCP)
- Lower bounce rates, as loading times are perceived as shorter
These aspects can also have a positive effect on SEO and general user satisfaction, especially in combination with a functioning caching concept.
Deactivation of speculative loading
Even if speculative loading can generally have a positive effect on the loading speed, there are use cases in which automatic preloading is undesirable - for example with sensitive content, personalized pages or dynamic parameters.
WordPress offers the option of deactivating or customizing this function. The following filter can be used for this purpose:
add_filter( ‚wp_enable_speculative_loading‘, ‚__return_false‘ );
This code can, for example, be integrated into the functions.php of the child theme or into a snippet plugin. This completely disables speculative loading.
Additional optimizations with Cloudflare
In combination with external solutions such as Cloudflare Speed Brain and the Super Page Cache for Cloudflare plugin, performance can be further increased:
- Speed Brain uses machine learning to analyze user behavior and preload relevant pages in a targeted manner.
- Super Page Cache enables full HTML caching on Cloudflare servers, allowing content to be delivered even faster - with no load on the origin server.
Conclusion
WordPress 6.8 integrates a modern browser function that can significantly improve loading speed without additional configuration. For many websites, speculative loading should be a useful addition to existing performance measures - especially in combination with caching solutions and content delivery networks (CDNs).
0 Comments