W3cubDocs

/WordPress

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

File: wp-includes/class-wp-rewrite.php

View on Trac

Changelog

Version Description
1.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/rewrite_rules_array