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.


Top ↑

Source

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

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.