# Prerender Links on Hover

> Upgrades WordPress speculative loading (6.8+) from prefetch to prerender with moderate eagerness, so pages open almost instantly after a hover.

- Type: PHP
- Runs: Frontend only
- Category: [Performance](https://wpide.com/library/category/performance/)
- Tags: performance, speculative-loading, prerender
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/prerender-on-hover/

## Code

```php
add_filter( 'wp_speculation_rules_configuration', function ( $config ) {
    if ( is_array( $config ) ) {
        $config['mode']      = 'prerender';
        $config['eagerness'] = 'moderate';
    }

    return $config;
} );
```

## Notes

Prerendering runs page scripts early; analytics tools that are not prerender-aware may count extra page views.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Prerender Links on Hover" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
