WP_Community_Events::cache_events

Advertisement

Summery Summery

Caches an array of events data from the Events API.

Syntax Syntax

WP_Community_Events::cache_events( array $events, int|bool $expiration = false )

Parameters Parameters

$events

(array) (Required) Response body from the API request.

$expiration

(int|bool) (Optional) Amount of time to cache the events. Defaults to false.

Default value: false

Return Return

(bool) true if events were cached; false if not.

Source Source

File: wp-admin/includes/class-wp-community-events.php

	protected function cache_events( $events, $expiration = false ) {
		$set              = false;
		$transient_key    = $this->get_events_transient_key( $events['location'] );
		$cache_expiration = $expiration ? absint( $expiration ) : HOUR_IN_SECONDS * 12;

		if ( $transient_key ) {
			$set = set_site_transient( $transient_key, $events, $cache_expiration );
		}

		return $set;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
4.8.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

What are you looking for?