WP_Theme_JSON::maybe_opt_in_into_settings() WordPress Method
The WP_Theme_JSON::maybe_opt_in_into_settings() method allows a theme to opt-in to having its settings data included in the WordPress Theme Customizer. This is useful for themes that want to make use of the WordPress Theme Customizer but don't necessarily want to provide their own settings page. By opting-in, the theme's settings data will be included in the WordPress Theme Customizer along with the other theme settings.
WP_Theme_JSON::maybe_opt_in_into_settings( array $theme_json ) #
Enables some opt-in settings if theme declared support.
Contents
Parameters
- $theme_json
(array)(Required)A theme.json structure to modify.
Return
(array) The modified theme.json structure.
Source
File: wp-includes/class-wp-theme-json.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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |