W3cubDocs

/WordPress

WP_Theme::get_pattern_cache(): array|false

Gets block pattern cache.

Return

array|false Returns an array of patterns if cache is found, otherwise false.

Source

private function get_pattern_cache() {
	if ( ! $this->exists() ) {
		return false;
	}

	$pattern_data = get_site_transient( 'wp_theme_files_patterns-' . $this->cache_hash );

	if ( is_array( $pattern_data ) && $pattern_data['version'] === $this->get( 'Version' ) ) {
		return $pattern_data['patterns'];
	}
	return false;
}

Changelog

Version Description
6.6.0 Uses transients to cache regardless of site environment.
6.4.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme/get_pattern_cache