WP_REST_Post_Statuses_Controller::get_item_schema()publicWP 4.7.0

Retrieves the post status' schema, conforming to JSON Schema.

Method of the class: WP_REST_Post_Statuses_Controller{}

No Hooks.

Return

Array. Item schema data.

Usage

$WP_REST_Post_Statuses_Controller = new WP_REST_Post_Statuses_Controller();
$WP_REST_Post_Statuses_Controller->get_item_schema();

Changelog

Since 4.7.0 Introduced.

WP_REST_Post_Statuses_Controller::get_item_schema() code WP 6.5.2

public function get_item_schema() {
	if ( $this->schema ) {
		return $this->add_additional_fields_schema( $this->schema );
	}

	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'status',
		'type'       => 'object',
		'properties' => array(
			'name'          => array(
				'description' => __( 'The title for the status.' ),
				'type'        => 'string',
				'context'     => array( 'embed', 'view', 'edit' ),
				'readonly'    => true,
			),
			'private'       => array(
				'description' => __( 'Whether posts with this status should be private.' ),
				'type'        => 'boolean',
				'context'     => array( 'edit' ),
				'readonly'    => true,
			),
			'protected'     => array(
				'description' => __( 'Whether posts with this status should be protected.' ),
				'type'        => 'boolean',
				'context'     => array( 'edit' ),
				'readonly'    => true,
			),
			'public'        => array(
				'description' => __( 'Whether posts of this status should be shown in the front end of the site.' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'queryable'     => array(
				'description' => __( 'Whether posts with this status should be publicly-queryable.' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'show_in_list'  => array(
				'description' => __( 'Whether to include posts in the edit listing for their post type.' ),
				'type'        => 'boolean',
				'context'     => array( 'edit' ),
				'readonly'    => true,
			),
			'slug'          => array(
				'description' => __( 'An alphanumeric identifier for the status.' ),
				'type'        => 'string',
				'context'     => array( 'embed', 'view', 'edit' ),
				'readonly'    => true,
			),
			'date_floating' => array(
				'description' => __( 'Whether posts of this status may have floating published dates.' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
		),
	);

	$this->schema = $schema;

	return $this->add_additional_fields_schema( $this->schema );
}