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)


Top ↑

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;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Added a check in the parent theme.
5.8.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.