WP_Object_Cache::get_multiple()publicWP 5.5.0

Retrieves multiple values from the cache in one call.

Method of the class: WP_Object_Cache{}

No Hooks.


Array. Array of return values, grouped by key. Each value is either the cache contents on success, or false on failure.


$WP_Object_Cache = new WP_Object_Cache();
$WP_Object_Cache->get_multiple( $keys, $group, $force );
$keys(array) (required)
Array of keys under which the cache contents are stored.
Where the cache contents are grouped.
Default: 'default'
Whether to force an update of the local cache from the persistent cache.
Default: false


Since 5.5.0 Introduced.

WP_Object_Cache::get_multiple() code WP 6.3

public function get_multiple( $keys, $group = 'default', $force = false ) {
	$values = array();

	foreach ( $keys as $key ) {
		$values[ $key ] = $this->get( $key, $group, $force );

	return $values;