On this page
WP_Theme::exists(): bool
Determines whether the theme exists.
Description
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.
Return
bool Whether the theme exists.
Source
File: wp-includes/class-wp-theme.php. View all references
public function exists() {
return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes(), true ) );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Theme::errors() wp-includes/class-wp-theme.php | Returns errors property. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Themes_Controller::get_item() wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves a single theme. |
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme/exists