функция since 0.71

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'
Часовой пояс для метки времени. Принимает 'server', 'blog' или 'gmt'. 'server' использует внутренний часовой пояс сервера. 'blog' использует поле post_date, которое соответствует часовому поясу, заданному для сайта. 'gmt' использует поле post_date_gmt. Значение по умолчанию 'server'.
$post_type string необязательный = 'any'
Тип записи для проверки. Значение по умолчанию '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.

Что будем искать? Например,Продвижение

Этот сайт использует куки-файлы. Оставаясь на сайте, Вы соглашаетесь на их использование. Для получения дополнительной информации, пожалуйста, ознакомьтесь с политикой в отношении персональных данных.