apply_filters( 'wp_speculation_rules_href_exclude_paths', string[] $href_exclude_paths, string $mode )
- Since
- 6.8.0
Filters the paths for which speculative loading should be disabled.
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.
Compatibility
- WordPress
- since 6.8.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 4 of the 5 tracked releases, added in 6.8.0.
Parameters
$href_exclude_pathsstring[]- Additional path patterns to disable speculative loading for.
$modestring- Mode used to apply speculative loading. Either 'prefetch' or 'prerender'.
Where this hook fires · 1
wp-includes/speculative-loading.php:241wp_get_speculation_rules()
Source code
* * @since 6.8.0 * * @param string[] $href_exclude_paths Additional path patterns to disable speculative loading for. * @param string $mode Mode used to apply speculative loading. Either 'prefetch' or 'prerender'. */ $href_exclude_paths = (array) apply_filters( 'wp_speculation_rules_href_exclude_paths', array(), $mode ); $href_exclude_paths = array_filter( $href_exclude_paths, 'is_string' ); // Ensure that: // 1. There are no duplicates. // 2. The base paths cannot be removed. // 3. The array has sequential keys (i.e. array_is_list()).Changelog
Introduced in 6.8.0. Unchanged from 6.8.8 through 7.1.0.
Signature, return type and hooks compared across 4 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.