Created
April 16, 2025 14:03
-
-
Save knolaust/df9dc2341ff5812ede40d924865cf1f1 to your computer and use it in GitHub Desktop.
Disable WP Speculative Loading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable Speculative Loading in WordPress | |
* | |
* WordPress 6.5+ introduces speculative loading (like prerendering and prefetching) | |
* to improve perceived performance by preloading likely navigation targets. | |
* This filter disables the feature entirely, which can be helpful if: | |
* - You're troubleshooting performance issues | |
* - You use dynamic or cache-sensitive content | |
* - You want full control over browser loading behavior | |
* | |
* To use: add this code to your theme's functions.php file or a custom plugin. | |
*/ | |
add_filter( | |
'wp_speculation_rules_configuration', | |
function ( $config ) { | |
// Returning null disables all speculative loading rules. | |
return null; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment