WP_Theme_JSON::get_settings() WordPress Method

The WP_Theme_JSON::get_settings() method is used to get the JSON encoded settings for a theme. This is useful if you need to store settings for a theme in a database or file.

WP_Theme_JSON::get_settings() #

Returns the existing settings for each block.


Description

Example:

{
  'root': {
    'color': {
      'custom': true
    }
  },
  'core/paragraph': {
    'spacing': {
      'customPadding': true
    }
  }
}

Top ↑

Return

(array) Settings per block.


Top ↑

Source

File: wp-includes/class-wp-theme-json.php

	public function get_settings() {
		if ( ! isset( $this->theme_json['settings'] ) ) {
			return array();
		} else {
			return $this->theme_json['settings'];
		}
	}

Top ↑

Changelog

Changelog
VersionDescription
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.