Title: wp_speculation_rules_href_exclude_paths
Published: February 24, 2026

---

# apply_filters( ‘wp_speculation_rules_href_exclude_paths’, string[] $href_exclude_paths, string $mode )

## In this article

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

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

Filters the paths for which speculative loading should be disabled.

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

All paths should start in a forward slash, relative to the root document. The `*`
can be used as a wildcard.
If the WordPress site is in a subdirectory, the exclude
paths will automatically be prefixed as necessary.

Note that WordPress always excludes certain path patterns such as `/wp-login.php`
and `/wp-admin/*`, and those cannot be modified using the filter.

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

 `$href_exclude_paths`string[]

Additional path patterns to disable speculative loading for.

`$mode`string

Mode used to apply speculative loading. Either `'prefetch'` or `'prerender'`.

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

    ```php
    $href_exclude_paths = (array) apply_filters( 'wp_speculation_rules_href_exclude_paths', array(), $mode );
    ```

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

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

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

Returns the full speculation rules data based on the configuration.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_speculation_rules_href_exclude_paths/?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_href_exclude_paths%2F)
before being able to contribute a note or feedback.