date_i18n
Filter HookDescription
Filters the date formatted based on the locale.Hook Information
File Location |
wp-includes/functions.php
View on GitHub
|
Hook Type | Filter |
Line Number | 221 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$date
|
Formatted date string. |
string
|
$format
|
Format to display the date. |
int
|
$timestamp
|
A sum of Unix timestamp and timezone offset in seconds. Might be without offset if input omitted timestamp but requested GMT. |
bool
|
$gmt
|
Whether to use GMT timezone. Only applies if timestamp was not provided. Default false. |
Usage Examples
Basic Usage
<?php
// Hook into date_i18n
add_filter('date_i18n', 'my_custom_filter', 10, 4);
function my_custom_filter($date, $format, $timestamp, $gmt) {
// Your custom filtering logic here
return $date;
}
Source Code Context
wp-includes/functions.php:221
- How this hook is used in WordPress core
<?php
216 * @param int $timestamp A sum of Unix timestamp and timezone offset in seconds.
217 * Might be without offset if input omitted timestamp but requested GMT.
218 * @param bool $gmt Whether to use GMT timezone. Only applies if timestamp was not provided.
219 * Default false.
220 */
221 $date = apply_filters( 'date_i18n', $date, $format, $timestamp, $gmt );
222
223 return $date;
224 }
225
226 /**
PHP Documentation
<?php
/**
* Filters the date formatted based on the locale.
*
* @since 2.8.0
*
* @param string $date Formatted date string.
* @param string $format Format to display the date.
* @param int $timestamp A sum of Unix timestamp and timezone offset in seconds.
* Might be without offset if input omitted timestamp but requested GMT.
* @param bool $gmt Whether to use GMT timezone. Only applies if timestamp was not provided.
* Default false.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/functions.php
Related Hooks
Related hooks will be displayed here in future updates.