wordpress

disable speculative loading introduced in wp 6.8


Is there a filter to disable speculative loading in wp 6.8? I’ve tried:

apply_filters( 'wp_speculation_rules_configuration', null );

But the script is still present. Thanks for any hint.


Solution

  • The filter: wp_speculation_rules_configuration is present inside the ./wp-includes/speculative-loading.php file. So this should work.

    But there is a minor mistake in your code: You're trying to pass null with "apply_filters" but you have to use "add_filter" like:

    add_filter( 'wp_speculation_rules_configuration', '__return_null' );
    

    __return_null is a built-in WordPress helper function that just returns null.