Title: wp_theme_has_theme_json
Published: March 29, 2023
Last modified: February 24, 2026

---

# wp_theme_has_theme_json(): bool

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#wp--skip-link--target)

Checks whether a theme or its parent has a theme.json file.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#return)󠁿

 bool Returns true if theme or its parent has a theme.json file, false otherwise.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/global-styles-and-settings.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/global-styles-and-settings.php#L400)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/global-styles-and-settings.php#L400-L432)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#hooks)󠁿

 [apply_filters( ‘theme_file_path’, string $path, string $file )](https://developer.wordpress.org/reference/hooks/theme_file_path/)

Filters the path to a file in the theme.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_is_development_mode()](https://developer.wordpress.org/reference/functions/wp_is_development_mode/)`wp-includes/load.php` |

Checks whether the site is in the given development mode.

  | 
| [get_stylesheet_directory()](https://developer.wordpress.org/reference/functions/get_stylesheet_directory/)`wp-includes/theme.php` |

Retrieves stylesheet directory path for the active theme.

  | 
| [get_template_directory()](https://developer.wordpress.org/reference/functions/get_template_directory/)`wp-includes/theme.php` |

Retrieves template directory path for the active theme.

  | 
| [get_stylesheet()](https://developer.wordpress.org/reference/functions/get_stylesheet/)`wp-includes/theme.php` |

Retrieves name of the current stylesheet.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#)

| Used by | Description | 
| [WP_Duotone::restore_image_outer_container()](https://developer.wordpress.org/reference/classes/wp_duotone/restore_image_outer_container/)`wp-includes/class-wp-duotone.php` |

Fixes the issue with our generated class name not being added to the block’s outer container in classic themes due to gutenberg_restore_image_outer_container from layout block supports.

  | 
| [wp_get_global_styles_custom_css()](https://developer.wordpress.org/reference/functions/wp_get_global_styles_custom_css/)`wp-includes/deprecated.php` |

Gets the global styles custom CSS from theme.json.

  | 
| [wp_enqueue_classic_theme_styles()](https://developer.wordpress.org/reference/functions/wp_enqueue_classic_theme_styles/)`wp-includes/script-loader.php` |

Loads classic theme styles on classic themes in the frontend.

  | 
| [wp_add_editor_classic_theme_styles()](https://developer.wordpress.org/reference/functions/wp_add_editor_classic_theme_styles/)`wp-includes/deprecated.php` |

Loads classic theme styles on classic themes in the editor.

  | 
| [wp_get_global_styles_svg_filters()](https://developer.wordpress.org/reference/functions/wp_get_global_styles_svg_filters/)`wp-includes/deprecated.php` |

Returns a string containing the SVGs to be referenced as filters (duotone).

  | 
| [_register_remote_theme_patterns()](https://developer.wordpress.org/reference/functions/_register_remote_theme_patterns/)`wp-includes/block-patterns.php` |

Registers patterns from Pattern Directory provided by a theme’s `theme.json` file.

  | 
| [_wp_get_iframed_editor_assets()](https://developer.wordpress.org/reference/functions/_wp_get_iframed_editor_assets/)`wp-includes/block-editor.php` |

Collect the block editor assets that need to be loaded into the editor’s iframe.

  | 
| [_wp_theme_json_webfonts_handler()](https://developer.wordpress.org/reference/functions/_wp_theme_json_webfonts_handler/)`wp-includes/deprecated.php` |

Runs the theme.json webfonts handler.

  | 
| [wp_get_global_settings()](https://developer.wordpress.org/reference/functions/wp_get_global_settings/)`wp-includes/global-styles-and-settings.php` |

Gets the settings resulting of merging core, theme, and user data.

  | 
| [wp_get_global_stylesheet()](https://developer.wordpress.org/reference/functions/wp_get_global_stylesheet/)`wp-includes/global-styles-and-settings.php` |

Returns the stylesheet resulting of merging core, theme, and user data.

  | 
| [WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles()](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_user_data_from_wp_global_styles/)`wp-includes/class-wp-theme-json-resolver.php` |

Returns the custom post type that contains the user’s origin config for the active theme or an empty array if none are found.

  | 
| [_add_block_template_info()](https://developer.wordpress.org/reference/functions/_add_block_template_info/)`wp-includes/block-template-utils.php` |

Attempts to add custom template information to the template item.

  | 
| [_add_block_template_part_area_info()](https://developer.wordpress.org/reference/functions/_add_block_template_part_area_info/)`wp-includes/block-template-utils.php` |

Attempts to add the template part’s area information to the input template.

  | 
| [WP_Theme_JSON_Resolver::get_theme_data()](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_theme_data/)`wp-includes/class-wp-theme-json-resolver.php` |

Returns the theme’s data.

  | 
| [WP_Theme_JSON_Resolver::theme_has_support()](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/theme_has_support/)`wp-includes/class-wp-theme-json-resolver.php` |

Determines whether the active theme has a theme.json file.

  | 
| [wp_enable_block_templates()](https://developer.wordpress.org/reference/functions/wp_enable_block_templates/)`wp-includes/theme-templates.php` |

Enables the block templates (editor mode) for themes with theme.json by default.

  | 
| [get_block_editor_settings()](https://developer.wordpress.org/reference/functions/get_block_editor_settings/)`wp-includes/block-editor.php` |

Returns the contextualized block editor settings for a selected editor context.

  | 
| [wp_default_styles()](https://developer.wordpress.org/reference/functions/wp_default_styles/)`wp-includes/script-loader.php` |

Assigns default styles to $styles object.

  |

[Show 13 more](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_theme_has_theme_json/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.2.0](https://developer.wordpress.org/reference/since/6.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_theme_has_theme_json%2F)
before being able to contribute a note or feedback.