get_lastpostdate()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
get_lastpostdate( string $timezone = 'server', string $post_type = 'any' ): string
Описание
Часовой пояс сервера используется по умолчанию и представляет разницу между GMT и временем сервера. Значение 'blog' — это дата публикации последней записи.
Значение 'gmt' — это дата публикации последней записи в формате GMT.
Оригинал (английский)
The server timezone is the default and is the difference between GMT and server time. The ‘blog’ value is the date when the last post was posted.
The ‘gmt’ is when the last post was posted in GMT formatted date.
Параметры
$timezone
string
необязательный
= 'server'
$post_type
string
необязательный
= 'any'
Возвращаемое значение
string
Исходный код
wp-includes/post.php:7542
function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
$lastpostdate = _get_last_post_time( $timezone, 'date', $post_type );
/**
* Filters the most recent time that a post on the site was published.
*
* @since 2.3.0
* @since 5.5.0 Added the `$post_type` parameter.
*
* @param string|false $lastpostdate The most recent time that a post was published,
* in 'Y-m-d H:i:s' format. False on failure.
* @param string $timezone Location to use for getting the post published date.
* See get_lastpostdate() for accepted `$timezone` values.
* @param string $post_type The post type to check.
*/
return apply_filters( 'get_lastpostdate', $lastpostdate, $timezone, $post_type );
}
История изменений
| Версия | Описание |
|---|---|
| 4.4.0 | The $post_type argument was added. |
| 0.71 | Introduced. |

