Filter hook 'rewrite_rules_array'

in WP Core File wp-includes/class-wp-rewrite.php at line 1476

View Source

rewrite_rules_array

Filter Hook
Description
Filters the full set of generated rewrite rules.

Hook Information

File Location wp-includes/class-wp-rewrite.php View on GitHub
Hook Type Filter
Line Number 1476

Hook Parameters

Type Name Description
string[] $rules The compiled array of rewrite rules, keyed by their regex pattern.

Usage Examples

Basic Usage
<?php
// Hook into rewrite_rules_array
add_filter('rewrite_rules_array', 'my_custom_filter', 10, 1);

function my_custom_filter($rules) {
    // Your custom filtering logic here
    return $rules;
}

Source Code Context

wp-includes/class-wp-rewrite.php:1476 - How this hook is used in WordPress core
<?php
1471  		 *
1472  		 * @since 1.5.0
1473  		 *
1474  		 * @param string[] $rules The compiled array of rewrite rules, keyed by their regex pattern.
1475  		 */
1476  		$this->rules = apply_filters( 'rewrite_rules_array', $this->rules );
1477  
1478  		return $this->rules;
1479  	}
1480  
1481  	/**

PHP Documentation

<?php
/**
		 * Filters the full set of generated rewrite rules.
		 *
		 * @since 1.5.0
		 *
		 * @param string[] $rules The compiled array of 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.