rewrite_rules_array WordPress Filter Hook
The rewrite_rules_array hook is used to modify the array of rewrite rules used by WordPress. This can be used to add or remove rules, or to modify existing rules.
apply_filters( 'rewrite_rules_array', string[] $rules ) #
Filters the full set of generated rewrite rules.
Parameters
- $rules
(string[])The compiled array of rewrite rules, keyed by their regex pattern.
More Information
- This filter hook can be used to any rule in the rewrite rules array.
- Since rewrite rules are saved to the database, you must flush/update your rules from your admin under Settings > Permalinks before your changes will take effect. You can also use the flush_rules() function to do this programmatically.
- Make sure you return the $rules array or very bad things will happen.
Source
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |