search_rewrite_rules WordPress Filter Hook
The search_rewrite_rules hook is used to filter the search rewrite rules before they are generated. This can be used to add or remove rules, or to modify the query string or redirect URL.
apply_filters( 'search_rewrite_rules', string[] $search_rewrite ) #
Filters rewrite rules used for search archives.
Description
Likely search-related archives include /search/search+query/
as well as pagination and feed paths for a search.
Parameters
- $search_rewrite
(string[])Array of rewrite rules for search queries, keyed by their regex pattern.
Source
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |