# wp_theme_has_theme_json()

URL: https://chugunov.pro/api-wordpress/functions/wp_theme_has_theme_json/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 6.2.0.

## Сигнатура

```php
wp_theme_has_theme_json(): bool
```

## Описание

Проверяет, есть ли у темы или её родительской темы файл theme.json.

## Возвращаемое значение

`bool`

## Исходный код

Файл: `wp-includes/global-styles-and-settings.php:391`

```php
function wp_theme_has_theme_json() {
	static $theme_has_support = array();

	$stylesheet = get_stylesheet();

	if (
		isset( $theme_has_support[ $stylesheet ] ) &&
		/*
		 * Ignore static cache when the development mode is set to 'theme', to avoid interfering with
		 * the theme developer's workflow.
		 */
		! wp_is_development_mode( 'theme' )
	) {
		return $theme_has_support[ $stylesheet ];
	}

	$stylesheet_directory = get_stylesheet_directory();
	$template_directory   = get_template_directory();

	// This is the same as get_theme_file_path(), which isn't available in load-styles.php context
	if ( $stylesheet_directory !== $template_directory && file_exists( $stylesheet_directory . '/theme.json' ) ) {
		$path = $stylesheet_directory . '/theme.json';
	} else {
		$path = $template_directory . '/theme.json';
	}

	/** This filter is documented in wp-includes/link-template.php */
	$path = apply_filters( 'theme_file_path', $path, 'theme.json' );

	$theme_has_support[ $stylesheet ] = file_exists( $path );

	return $theme_has_support[ $stylesheet ];
}
```

## История изменений

- 6.2.0 — Introduced.

## Связанные

Использует: [`wp_is_development_mode`](https://chugunov.pro/api-wordpress/functions/wp_is_development_mode/), [`get_stylesheet_directory`](https://chugunov.pro/api-wordpress/functions/get_stylesheet_directory/), [`get_template_directory`](https://chugunov.pro/api-wordpress/functions/get_template_directory/), [`get_stylesheet`](https://chugunov.pro/api-wordpress/functions/get_stylesheet/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: `WP_Duotone::restore_image_outer_container`, [`wp_get_global_styles_custom_css`](https://chugunov.pro/api-wordpress/functions/wp_get_global_styles_custom_css/), [`wp_add_editor_classic_theme_styles`](https://chugunov.pro/api-wordpress/functions/wp_add_editor_classic_theme_styles/), [`wp_enqueue_classic_theme_styles`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_classic_theme_styles/), [`wp_get_global_styles_svg_filters`](https://chugunov.pro/api-wordpress/functions/wp_get_global_styles_svg_filters/), [`_register_remote_theme_patterns`](https://chugunov.pro/api-wordpress/functions/_register_remote_theme_patterns/), [`_wp_get_iframed_editor_assets`](https://chugunov.pro/api-wordpress/functions/_wp_get_iframed_editor_assets/), [`_wp_theme_json_webfonts_handler`](https://chugunov.pro/api-wordpress/functions/_wp_theme_json_webfonts_handler/), [`wp_get_global_stylesheet`](https://chugunov.pro/api-wordpress/functions/wp_get_global_stylesheet/), [`_add_block_template_info`](https://chugunov.pro/api-wordpress/functions/_add_block_template_info/), [`_add_block_template_part_area_info`](https://chugunov.pro/api-wordpress/functions/_add_block_template_part_area_info/), `WP_Theme_JSON_Resolver::get_theme_data`, `WP_Theme_JSON_Resolver::theme_has_support`, [`wp_enable_block_templates`](https://chugunov.pro/api-wordpress/functions/wp_enable_block_templates/), [`wp_default_styles`](https://chugunov.pro/api-wordpress/functions/wp_default_styles/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/
