rewrite_rules_array

Filters the full set of generated rewrite rules.

Description

apply_filters( 'rewrite_rules_array', (array) $this_rules ); 

Parameters (1)

0. $this_rules (array)
The compiled array of rewrite rules.

Usage

To run the hook, copy the example below.
  1. $this_rules = apply_filters( 'rewrite_rules_array', $this_rules ); 
  2.  
  3. if ( !empty( $this_rules ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the rewrite_rules_array callback 
  2. function filter_rewrite_rules_array( $this_rules ) { 
  3. // make filter magic happen here... 
  4. return $this_rules
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'rewrite_rules_array', 'filter_rewrite_rules_array', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'rewrite_rules_array', 'filter_rewrite_rules_array', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/class-wp-rewrite.php  
  1. $this->rules = apply_filters( 'rewrite_rules_array', $this->rules );