WP_Theme::get_pattern_cache
Gets block pattern cache.
Method of the class: WP_Theme{}
No Hooks.
Returns
Array|false. Returns an array of patterns if cache is found, otherwise false.
Usage
// private - for code of main (parent) class only $result = $this->get_pattern_cache();
Changelog
| Since 6.4.0 | Introduced. |
| Since 6.6.0 | Uses transients to cache regardless of site environment. |
WP_Theme::get_pattern_cache() WP Theme::get pattern cache code WP 6.9.1
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;
}