date_rewrite_rules
Filter HookDescription
Filters rewrite rules used for date archives. Likely date archives would include `/yyyy/`, `/yyyy/mm/`, and `/yyyy/mm/dd/`.Hook Information
File Location |
wp-includes/class-wp-rewrite.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1333 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$date_rewrite
|
Array of rewrite rules for date archives, keyed by their regex pattern. |
Usage Examples
Basic Usage
<?php
// Hook into date_rewrite_rules
add_filter('date_rewrite_rules', 'my_custom_filter', 10, 1);
function my_custom_filter($date_rewrite) {
// Your custom filtering logic here
return $date_rewrite;
}
Source Code Context
wp-includes/class-wp-rewrite.php:1333
- How this hook is used in WordPress core
<?php
1328 *
1329 * @since 1.5.0
1330 *
1331 * @param string[] $date_rewrite Array of rewrite rules for date archives, keyed by their regex pattern.
1332 */
1333 $date_rewrite = apply_filters( 'date_rewrite_rules', $date_rewrite );
1334
1335 // Root-level rewrite rules.
1336 $root_rewrite = $this->generate_rewrite_rules( $this->root . '/', EP_ROOT );
1337
1338 /**
PHP Documentation
<?php
/**
* Filters rewrite rules used for date archives.
*
* Likely date archives would include `/yyyy/`, `/yyyy/mm/`, and `/yyyy/mm/dd/`.
*
* @since 1.5.0
*
* @param string[] $date_rewrite Array of rewrite rules for date archives, 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.