Filter hook 'page_rewrite_rules'

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

View Source

page_rewrite_rules

Filter Hook
Description
Filters rewrite rules used for "page" post type archives.

Hook Information

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

Hook Parameters

Type Name Description
string[] $page_rewrite Array of rewrite rules for the "page" post type, keyed by their regex pattern.

Usage Examples

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

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

Source Code Context

wp-includes/class-wp-rewrite.php:1405 - How this hook is used in WordPress core
<?php
1400  		 *
1401  		 * @since 1.5.0
1402  		 *
1403  		 * @param string[] $page_rewrite Array of rewrite rules for the "page" post type, keyed by their regex pattern.
1404  		 */
1405  		$page_rewrite = apply_filters( 'page_rewrite_rules', $page_rewrite );
1406  
1407  		// Extra permastructs.
1408  		foreach ( $this->extra_permastructs as $permastructname => $struct ) {
1409  			if ( is_array( $struct ) ) {
1410  				if ( count( $struct ) === 2 ) {

PHP Documentation

<?php
/**
		 * Filters rewrite rules used for "page" post type archives.
		 *
		 * @since 1.5.0
		 *
		 * @param string[] $page_rewrite Array of rewrite rules for the "page" post type, 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.