root_rewrite_rules
Filter HookDescription
Filters rewrite rules used for root-level archives. Likely root-level archives would include pagination rules for the homepage as well as site-wide post feeds (e.g. `/feed/`, and `/feed/atom/`).Hook Information
File Location |
wp-includes/class-wp-rewrite.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1348 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$root_rewrite
|
Array of root-level rewrite rules, keyed by their regex pattern. |
Usage Examples
Basic Usage
<?php
// Hook into root_rewrite_rules
add_filter('root_rewrite_rules', 'my_custom_filter', 10, 1);
function my_custom_filter($root_rewrite) {
// Your custom filtering logic here
return $root_rewrite;
}
Source Code Context
wp-includes/class-wp-rewrite.php:1348
- How this hook is used in WordPress core
<?php
1343 *
1344 * @since 1.5.0
1345 *
1346 * @param string[] $root_rewrite Array of root-level rewrite rules, keyed by their regex pattern.
1347 */
1348 $root_rewrite = apply_filters( 'root_rewrite_rules', $root_rewrite );
1349
1350 // Comments rewrite rules.
1351 $comments_rewrite = $this->generate_rewrite_rules( $this->root . $this->comments_base, EP_COMMENTS, false, true, true, false );
1352
1353 /**
PHP Documentation
<?php
/**
* Filters rewrite rules used for root-level archives.
*
* Likely root-level archives would include pagination rules for the homepage
* as well as site-wide post feeds (e.g. `/feed/`, and `/feed/atom/`).
*
* @since 1.5.0
*
* @param string[] $root_rewrite Array of root-level rewrite rules, keyed by their regex pattern.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/class-wp-rewrite.php
Related Hooks
Related hooks will be displayed here in future updates.