WP_Community_Events::get_cached_events()publicWP 4.8.0

Gets cached events.

{} Это метод класса: WP_Community_Events{}

Хуков нет.

Возвращает

Массив|false. An array containing location and events items on success, false on failure.

Использование

$WP_Community_Events = new WP_Community_Events();
$WP_Community_Events->get_cached_events();

Список изменений

С версии 4.8.0 Введена.
С версии 5.5.2 Response no longer contains formatted date field. They're added in wp.communityEvents.populateDynamicEventFields() now.

Код WP_Community_Events::get_cached_events() WP 6.0.2

public function get_cached_events() {
	$cached_response = get_site_transient( $this->get_events_transient_key( $this->user_location ) );

	if ( isset( $cached_response['events'] ) ) {
		$cached_response['events'] = $this->trim_events( $cached_response['events'] );
	}

	return $cached_response;
}