Title: WP_Theme::cache_get
Published: April 25, 2014
Last modified: August 20, 2026

---

# WP_Theme::cache_get( string $key ): mixed

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#changelog)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Gets theme data from cache.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#description)󠁿

Cache entries are keyed by the theme and the type of data.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#parameters)󠁿

 `$key`stringrequired

Type of data to retrieve (theme, screenshot, headers, post_templates)

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#return)󠁿

 mixed Retrieved data

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#source)󠁿

    ```php
    private function cache_get( $key ) {
    	return wp_cache_get( $key . '-' . $this->cache_hash, 'themes' );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-theme.php#L827)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-theme.php#L827-L829)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_cache_get()](https://developer.wordpress.org/reference/functions/wp_cache_get/)`wp-includes/cache.php` |

Retrieves the cache contents from the cache by key and group.

  |

| Used by | Description | 
| [WP_Theme::get_post_templates()](https://developer.wordpress.org/reference/classes/wp_theme/get_post_templates/)`wp-includes/class-wp-theme.php` |

Returns the theme’s post templates.

  | 
| [WP_Theme::get_screenshot()](https://developer.wordpress.org/reference/classes/wp_theme/get_screenshot/)`wp-includes/class-wp-theme.php` |

Returns the main screenshot file for the theme.

  | 
| [WP_Theme::get()](https://developer.wordpress.org/reference/classes/wp_theme/get/)`wp-includes/class-wp-theme.php` |

Gets a raw, unformatted theme header.

  | 
| [WP_Theme::__construct()](https://developer.wordpress.org/reference/classes/wp_theme/__construct/)`wp-includes/class-wp-theme.php` |

Constructor for [WP_Theme](https://developer.wordpress.org/reference/classes/wp_theme/).

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme/cache_get/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fcache_get%2F)
before being able to contribute a note or feedback.