WP_Theme_JSON_Resolver::theme_has_support() WordPress Method
The WP_Theme_JSON_Resolver::theme_has_support() function checks whether a theme has support for a given feature. This function is useful for checking whether a theme supports a particular feature before using it. For example, if you want to use the post-thumbnails feature in your theme, you would first check if the theme supports it before adding the code to your theme. This function returns true if the theme has support for the given feature, false otherwise.
WP_Theme_JSON_Resolver::theme_has_support() #
Determines whether the active theme has a theme.json file.
Return
(bool)
Source
File: wp-includes/class-wp-theme-json-resolver.php
public static function theme_has_support() { if ( ! isset( static::$theme_has_support ) ) { static::$theme_has_support = ( is_readable( static::get_file_path_from_theme( 'theme.json' ) ) || is_readable( static::get_file_path_from_theme( 'theme.json', true ) ) ); } return static::$theme_has_support; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.9.0 | Added a check in the parent theme. |
5.8.0 | Introduced. |