WP_REST_Autosaves_Controller::get_item_schema() WordPress Method
The WP_REST_Autosaves_Controller::get_item_schema() method is used to return the schema for a single item of data for the WordPress REST API. This is a useful tool for developers who want to create their own API endpoints or extend the existing WordPress REST API.
WP_REST_Autosaves_Controller::get_item_schema() #
Retrieves the autosave’s schema, conforming to JSON Schema.
Return
(array) Item schema data.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}
$schema = $this->revisions_controller->get_item_schema();
$schema['properties']['preview_link'] = array(
'description' => __( 'Preview link for the post.' ),
'type' => 'string',
'format' => 'uri',
'context' => array( 'edit' ),
'readonly' => true,
);
$this->schema = $schema;
return $this->add_additional_fields_schema( $this->schema );
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |