Open pages instantly on hover
When a visitor hovers over a link or starts tapping it, the browser starts loading that page, so it opens almost instantly. Uses WordPress’s speculative loading (6.8+).
<?php
add_filter(
'wp_speculation_rules_configuration',
static function ( $config ) {
if ( ! is_array( $config ) ) {
return $config; // Switched off (for example for logged-in users): leave it.
}
$config['mode'] = 'prerender';
$config['eagerness'] = 'moderate';
return $config;
}
);
Good to know
Prerendering runs page scripts early, which some analytics count as a visit. Use “conservative” instead of “moderate” for fewer extra loads.
In these packs
- More speed: More ways to load less: block styles, speculative loading, fewer scripts.