Title: WP_Theme_JSON::maybe_opt_in_into_settings
Published: February 3, 2022
Last modified: May 20, 2026

---

# WP_Theme_JSON::maybe_opt_in_into_settings( array $theme_json ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json/maybe_opt_in_into_settings/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme_json/maybe_opt_in_into_settings/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme_json/maybe_opt_in_into_settings/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json/maybe_opt_in_into_settings/?output_format=md#changelog)

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

Enables some opt-in settings if theme declared support.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json/maybe_opt_in_into_settings/?output_format=md#parameters)󠁿

 `$theme_json`arrayrequired

A theme.json structure to modify.

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

 array The modified theme.json structure.

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

    ```php
    protected static function maybe_opt_in_into_settings( $theme_json ) {
    	$new_theme_json = $theme_json;

    	if (
    		isset( $new_theme_json['settings']['appearanceTools'] ) &&
    		true === $new_theme_json['settings']['appearanceTools']
    	) {
    		static::do_opt_in_into_settings( $new_theme_json['settings'] );
    	}

    	if ( isset( $new_theme_json['settings']['blocks'] ) && is_array( $new_theme_json['settings']['blocks'] ) ) {
    		foreach ( $new_theme_json['settings']['blocks'] as &$block ) {
    			if ( isset( $block['appearanceTools'] ) && ( true === $block['appearanceTools'] ) ) {
    				static::do_opt_in_into_settings( $block );
    			}
    		}
    	}

    	return $new_theme_json;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme-json.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-theme-json.php#L969)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-theme-json.php#L969-L988)

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

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

## User Contributed Notes

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