Title: WP_Theme::get
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_Theme::get( string $header ): string|array|false

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#wp--skip-link--target)

Gets a raw, unformatted theme header.

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

The header is sanitized, but is not translated, and is not marked up for display.

To get a theme header for display, use the display() method.

Use the [get_template()](https://developer.wordpress.org/reference/functions/get_template/)
method, not the ‘Template’ header, for finding the template.
The ‘Template’ header
is only good for what was written in the style.css, while [get_template()](https://developer.wordpress.org/reference/functions/get_template/)
takes into account where WordPress actually located the theme and whether it is 
actually valid.

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

 `$header`stringrequired

Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.

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

 string|array|false String or array (for Tags header) on success, false on failure.

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

    ```php
    public function get( $header ) {
    	if ( ! isset( $this->headers[ $header ] ) ) {
    		return false;
    	}

    	if ( ! isset( $this->headers_sanitized ) ) {
    		$this->headers_sanitized = $this->cache_get( 'headers' );
    		if ( ! is_array( $this->headers_sanitized ) ) {
    			$this->headers_sanitized = array();
    		}
    	}

    	if ( isset( $this->headers_sanitized[ $header ] ) ) {
    		return $this->headers_sanitized[ $header ];
    	}

    	// If themes are a persistent group, sanitize everything and cache it. One cache add is better than many cache sets.
    	if ( self::$persistently_cache ) {
    		foreach ( array_keys( $this->headers ) as $_header ) {
    			$this->headers_sanitized[ $_header ] = $this->sanitize_header( $_header, $this->headers[ $_header ] );
    		}
    		$this->cache_add( 'headers', $this->headers_sanitized );
    	} else {
    		$this->headers_sanitized[ $header ] = $this->sanitize_header( $header, $this->headers[ $header ] );
    	}

    	return $this->headers_sanitized[ $header ];
    }
    ```

[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/6.9.4/src/wp-includes/class-wp-theme.php#L870)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-theme.php#L870-L897)

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

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

Gets theme data from cache.

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

Sanitizes a theme header.

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

Adds theme data to cache.

  |

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

Gets block pattern cache.

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

Sets block pattern cache.

  | 
| [WP_Theme_JSON_Resolver::get_theme_data()](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_theme_data/)`wp-includes/class-wp-theme-json-resolver.php` |

Returns the theme’s data.

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

Marks up a theme header.

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

Translates a theme header.

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

Loads the theme’s textdomain.

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

__get() magic method for properties formerly returned by [current_theme_info()](https://developer.wordpress.org/reference/functions/current_theme_info/)

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

Gets a theme header, formatted and translated for display.

  |

[Show 4 more](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#)

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

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

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/classes/wp_theme/get/?output_format=md#comment-content-5991)
 2.   [chifarol](https://profiles.wordpress.org/chifarol/)  [  4 years ago  ](https://developer.wordpress.org/reference/classes/wp_theme/get/#comment-5991)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fget%2F%23comment-5991)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fget%2F%23comment-5991)
 4. get current theme’s version
     `$version = wp_get_theme()->get( 'version' )`
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fget%2F%3Freplytocom%3D5991%23feedback-editor-5991)

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