Warning: This function has been deprecated. Use wp_get_theme() instead.

get_theme_data() WordPress Function

The get_theme_data() function is used to retrieve the theme data of a WordPress theme. The theme data is stored in the WordPress database as an array. The function can be used to retrieve the data for a specific theme or for all themes.

get_theme_data( string $theme_file ) #

Retrieve theme data from parsed theme file.


Description

Top ↑

See also


Top ↑

Parameters

$theme_file

(string)(Required)Theme file path.


Top ↑

Return

(array) Theme data.


Top ↑

Source

File: wp-includes/deprecated.php

function get_theme_data( $theme_file ) {
	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
	$theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );

	$theme_data = array(
		'Name' => $theme->get('Name'),
		'URI' => $theme->display('ThemeURI', true, false),
		'Description' => $theme->display('Description', true, false),
		'Author' => $theme->display('Author', true, false),
		'AuthorURI' => $theme->display('AuthorURI', true, false),
		'Version' => $theme->get('Version'),
		'Template' => $theme->get('Template'),
		'Status' => $theme->get('Status'),
		'Tags' => $theme->get('Tags'),
		'Title' => $theme->get('Name'),
		'AuthorName' => $theme->get('Author'),
	);

	foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
		if ( ! isset( $theme_data[ $extra_header ] ) )
			$theme_data[ $extra_header ] = $theme->get( $extra_header );
	}

	return $theme_data;
}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Use wp_get_theme()
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More