post_rewrite_rules
Filters rewrite rules used for "post" archives.
Usage
add_filter( 'post_rewrite_rules', 'wp_kama_post_rewrite_rules_filter' ); /** * Function for `post_rewrite_rules` filter-hook. * * @param string[] $post_rewrite Array of rewrite rules for posts, keyed by their regex pattern. * * @return string[] */ function wp_kama_post_rewrite_rules_filter( $post_rewrite ){ // filter... return $post_rewrite; }
- $post_rewrite(string[])
- Array of rewrite rules for posts, keyed by their regex pattern.
Changelog
Since 1.5.0 | Introduced. |
Where the hook is called
post_rewrite_rules
wp-includes/class-wp-rewrite.php 1316
$post_rewrite = apply_filters( 'post_rewrite_rules', $post_rewrite );