Skip to content

Snippet: How to Disable Speculative Loading in WordPress

WordPress 6.8 introduces a new performance feature called speculative loading, which is enabled on all sites by default. This feature uses the browser’s Speculation Rules API to anticipate which links users might click and preloads them in the background. While this can speed things up for visitors it could unnecessary server resource usage or unintended user interactions.

For most websites, speculative loading can be beneficial and is best left enabled. However, if you decide it’s not the right fit for your site, you can easily turn it off by adding a single line of code to your child theme’s functions.php file or by using a code snippet plugin.

add_filter( 'wp_speculation_rules_configuration', '__return_null' );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top