WP_Theme::__isset() WordPress Method

The WP_Theme::__isset() method is used to check if a theme has a given property. This can be useful if you want to programmatically check if a theme has a certain feature or setting. For example, you could use this method to check if a theme has a custom header image before displaying it on your site.

WP_Theme::__isset( string $offset ) #

__isset() magic method for properties formerly returned by current_theme_info()


Parameters

$offset

(string)(Required)Property to check if set.


Top ↑

Return

(bool) Whether the given property is set.


Top ↑

Source

File: wp-includes/class-wp-theme.php

	public function __isset( $offset ) {
		static $properties = array(
			'name',
			'title',
			'version',
			'parent_theme',
			'template_dir',
			'stylesheet_dir',
			'template',
			'stylesheet',
			'screenshot',
			'description',
			'author',
			'tags',
			'theme_root',
			'theme_root_uri',
		);

		return in_array( $offset, $properties, true );
	}

Top ↑

Changelog

Changelog
VersionDescription
3.4.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.