apply_filters( 'date_formats', string[] $default_date_formats )
- Since
- 2.7.0, 4.0.0, 6.8.0
Filters the default date formats.
Compatibility
- WordPress
- since 6.8.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$default_date_formatsstring[]- Array of default date formats.
Where this hook fires · 1
wp-admin/options-general.php:498file scope
Source code
* @since 2.7.0 * @since 4.0.0 Replaced the `Y/m/d` format with `Y-m-d` (ISO date standard YYYY-MM-DD). * @since 6.8.0 Added the `d.m.Y` format. * * @param string[] $default_date_formats Array of default date formats. */ $date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y', 'd.m.Y' ) ) ); $custom = true; foreach ( $date_formats as $format ) { echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'"; if ( get_option( 'date_format' ) === $format ) { // checked() uses "==" rather than "===".Changelog
Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.8.0
Added the
d.m.Y format.from the docblock4.0.0
Replaced the
Y/m/d format with Y-m-d (ISO date standard YYYY-MM-DD).from the docblock2.7.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.