WP_Theme::exists()publicWP 3.4.0

Determines whether the theme exists.

A theme with errors exists. A theme with the error of 'theme_not_found', meaning that the theme's directory was not found, does not exist.

Method of the class: WP_Theme{}

No Hooks.

Return

true|false. Whether the theme exists.

Usage

$WP_Theme = new WP_Theme();
$WP_Theme->exists();

Changelog

Since 3.4.0 Introduced.

WP_Theme::exists() code WP 6.6.2

public function exists() {
	return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes(), true ) );
}