Skip to content

Instantly share code, notes, and snippets.

@mattheu
Last active April 29, 2025 07:45
Show Gist options
  • Save mattheu/46578643d9496a037f4762d8f3c7cc04 to your computer and use it in GitHub Desktop.
Save mattheu/46578643d9496a037f4762d8f3c7cc04 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Speculative Loading Eager Prerender
* Description: Overrides WordPress speculative loading rules to use "eager" and "prerender" for better perceived performance.
* Version: 1.0
* Author: Your Name
*/
add_filter(
'wp_speculation_rules_configuration',
function ( $config ) {
if ( is_array( $config ) ) {
$config['mode'] = 'prerender';
$config['eagerness'] = 'eager';
}
return $config;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment