Title: wp_speculation_rules_configuration
Published: February 24, 2026
Last modified: May 20, 2026

---

# apply_filters( ‘wp_speculation_rules_configuration’, array<string,  )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#wp--skip-link--target)

Filters the way that speculation rules are configured.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#description)󠁿

The Speculation Rules API is a web API that allows to automatically prefetch or 
prerender certain URLs on the page, which can lead to near-instant page load times.
This is also referred to as speculative loading.

There are two aspects to the configuration:

 * The “mode” (whether to “prefetch” or “prerender” URLs).
 * The “eagerness” (whether to speculatively load URLs in an “eager”, “moderate”,
   or “conservative” way).

By default, the speculation rules configuration is decided by WordPress Core (“auto”).
This filter can be used to force a certain configuration, which could for instance
load URLs more or less eagerly.

For logged-in users or for sites that are not configured to use pretty permalinks,
the default value is `null`, indicating that speculative loading is entirely disabled.

### 󠀁[See also](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#see-also)󠁿

 * [https://developer.chrome.com/docs/web-platform/prerender-pages](https://developer.chrome.com/docs/web-platform/prerender-pages/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#parameters)󠁿

string>|null $config Associative array with `'mode'` and `'eagerness'` keys, or `
null`. The default value for both of the keys is `'auto'`. Other possible values
for `'mode'` are `'prefetch'` and `'prerender'`. Other possible values for `'eagerness'`
are `'eager'`, `'moderate'`, and `'conservative'`. The value `null` is used to disable
speculative loading entirely.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#source)󠁿

    ```php
    $config = apply_filters( 'wp_speculation_rules_configuration', $config );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/speculative-loading.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/speculative-loading.php#L54)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/speculative-loading.php#L54-L54)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_get_speculation_rules_configuration()](https://developer.wordpress.org/reference/functions/wp_get_speculation_rules_configuration/)`wp-includes/speculative-loading.php` |

Returns the speculation rules configuration.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_configuration/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.8.0](https://developer.wordpress.org/reference/since/6.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_speculation_rules_configuration%2F)
before being able to contribute a note or feedback.