root_rewrite_rules
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/).
Использование
add_filter( 'root_rewrite_rules', 'wp_kama_root_rewrite_rules_filter' ); /** * Function for `root_rewrite_rules` filter-hook. * * @param string[] $root_rewrite Array of root-level rewrite rules, keyed by their regex pattern. * * @return string[] */ function wp_kama_root_rewrite_rules_filter( $root_rewrite ){ // filter... return $root_rewrite; }
- $root_rewrite(string[])
- Array of root-level rewrite rules, keyed by their regex pattern.
Список изменений
С версии 1.5.0 | Введена. |
Где вызывается хук
root_rewrite_rules
wp-includes/class-wp-rewrite.php 1345
$root_rewrite = apply_filters( 'root_rewrite_rules', $root_rewrite );