Uses
Uses | Description |
---|---|
wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php: WP_REST_Settings_Controller::get_registered_options() | Retrieves all of the registered options for the Settings API. |
Retrieves the site setting schema, conforming to JSON Schema.
(array) Item schema data.
File: wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
public function get_item_schema() { if ( $this->schema ) { return $this->add_additional_fields_schema( $this->schema ); } $options = $this->get_registered_options(); $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'settings', 'type' => 'object', 'properties' => array(), ); foreach ( $options as $option_name => $option ) { $schema['properties'][ $option_name ] = $option['schema']; $schema['properties'][ $option_name ]['arg_options'] = array( 'sanitize_callback' => array( $this, 'sanitize_callback' ), ); } $this->schema = $schema; return $this->add_additional_fields_schema( $this->schema ); }
Version | Description |
---|---|
4.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_settings_controller/get_item_schema