wppaste
WordPress

WP_Theme

Since
3.4.0
Source
wp-includes/class-wp-theme.php:9
WP_Theme Class

Compatibility

WordPress
since 3.4.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 11

Every hook that fires from inside WP_Theme, in the order it appears in the class, grouped by the method that fires it.

Properties · 20

$updateboolpublic
Whether the theme has been marked as updateable.
$file_headersstring[]private static
Headers for style.css files.
$default_themesstring[]private static
Default themes.
$tag_mapstring[]private static
Renamed theme tags.
$theme_rootstringprivate
Absolute path to the theme root, usually wp-content/themes
$headersarrayprivate
Header data from the theme's style.css file.
$headers_sanitizedarrayprivate
Header data from the theme's style.css file after being sanitized.
$block_themeboolprivate
Is this theme a block theme.
$name_translatedstringprivate
Header name from the theme's style.css after being translated.
$errorsWP_Errorprivate
Errors encountered when initializing the theme.
$stylesheetstringprivate
The directory name of the theme's files, inside the theme root.
$templatestringprivate
The directory name of the theme's files, inside the theme root.
$parentWP_Themeprivate
A reference to the parent theme, in the case of a child theme.
$theme_root_uristringprivate
URL to the theme root, usually an absolute URL to wp-content/themes
$textdomain_loadedboolprivate
Flag for whether the theme's textdomain is loaded.
$cache_hashstringprivate
Stores an md5 hash of the theme root, to function as the cache key.
$block_template_foldersstring[]private
Block template folders.
$default_template_foldersstring[]private
Default values for template folders.
$persistently_cacheboolprivate static
Flag for whether the themes cache bucket should be persistently cached.
$cache_expirationboolprivate static
Expiration time for the themes cache bucket.

Methods · 52

Source code

#[AllowDynamicProperties]final class WP_Theme implements ArrayAccess { 	/**	 * Whether the theme has been marked as updateable.	 *	 * @since 4.4.0	 * @var bool	 *	 * @see WP_MS_Themes_List_Table	 */	public $update = false; 	/**	 * Headers for style.css files.	 *	 * @since 3.4.0	 * @since 5.4.0 Added `Requires at least` and `Requires PHP` headers.	 * @since 6.1.0 Added `Update URI` header.	 * @var string[]	 */	private static $file_headers = array(		'Name'        => 'Theme Name',		'ThemeURI'    => 'Theme URI',		'Description' => 'Description',		'Author'      => 'Author',		'AuthorURI'   => 'Author URI',		'Version'     => 'Version',		'Template'    => 'Template',		'Status'      => 'Status',		'Tags'        => 'Tags',		'TextDomain'  => 'Text Domain',		'DomainPath'  => 'Domain Path',		'RequiresWP'  => 'Requires at least',		'RequiresPHP' => 'Requires PHP',		'UpdateURI'   => 'Update URI',	); 	/**	 * Default themes.	 *	 * @since 3.4.0	 * @since 3.5.0 Added the Twenty Twelve theme.	 * @since 3.6.0 Added the Twenty Thirteen theme.	 * @since 3.8.0 Added the Twenty Fourteen theme.	 * @since 4.1.0 Added the Twenty Fifteen theme.	 * @since 4.4.0 Added the Twenty Sixteen theme.	 * @since 4.7.0 Added the Twenty Seventeen theme.	 * @since 5.0.0 Added the Twenty Nineteen theme.	 * @since 5.3.0 Added the Twenty Twenty theme.	 * @since 5.6.0 Added the Twenty Twenty-One theme.	 * @since 5.9.0 Added the Twenty Twenty-Two theme.	 * @since 6.1.0 Added the Twenty Twenty-Three theme.	 * @since 6.4.0 Added the Twenty Twenty-Four theme.	 * @since 6.7.0 Added the Twenty Twenty-Five theme.	 * @var string[]	 */	private static $default_themes = array(		'classic'           => 'WordPress Classic',		'default'           => 'WordPress Default',		'twentyten'         => 'Twenty Ten',		'twentyeleven'      => 'Twenty Eleven',		'twentytwelve'      => 'Twenty Twelve',		'twentythirteen'    => 'Twenty Thirteen',		'twentyfourteen'    => 'Twenty Fourteen',		'twentyfifteen'     => 'Twenty Fifteen',		'twentysixteen'     => 'Twenty Sixteen',		'twentyseventeen'   => 'Twenty Seventeen',		'twentynineteen'    => 'Twenty Nineteen',		'twentytwenty'      => 'Twenty Twenty',		'twentytwentyone'   => 'Twenty Twenty-One',		'twentytwentytwo'   => 'Twenty Twenty-Two',		'twentytwentythree' => 'Twenty Twenty-Three',		'twentytwentyfour'  => 'Twenty Twenty-Four',		'twentytwentyfive'  => 'Twenty Twenty-Five',	); 	/**	 * Renamed theme tags.	 *

Changelog

Introduced in 3.4.0. One change between 6.7.7 and 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

7.0.4
Method _check_headers_property_has_correct_type() removed.verified against source
3.4.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/class-wp-theme.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.