Warning: This hook has been deprecated. Use the ‘mod_rewrite_rules’ filter instead.
rewrite_rules WordPress Hook
The rewrite_rules hook is one of the most powerful tools in the WordPress arsenal. It allows you to create and modify rewrite rules on the fly, without having to edit any files or restart any servers. This hook is called whenever the rewrite rules are flushed, which happens whenever you change the permalink structure of your site, or when you install or update a plugin or theme that modifies the rewrite rules. You can use this hook to add or remove rewrite rules, or to modify existing rewrite rules. For example, you could use it to add a new rewrite rule that redirects all traffic from example.com/foo to example.com/bar. If you're not a developer, then you probably won't ever need to use this hook. But if you are a developer, then it's an essential tool for customizing the behavior of your WordPress site.
apply_filters_deprecated( 'rewrite_rules', string $rules ) #
Filters the list of rewrite rules formatted for output to an .htaccess file.
Parameters
- $rules
(string)mod_rewrite Rewrite rules formatted for .htaccess.
Source
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |