Title: WP_REST_Templates_Controller::get_item_schema
Published: July 20, 2021
Last modified: February 24, 2026

---

# WP_REST_Templates_Controller::get_item_schema(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#wp--skip-link--target)

Retrieves the block type’ schema, conforming to JSON Schema.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#return)󠁿

 array Item schema data.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#source)󠁿

    ```php
    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'      => $this->post_type,
    		'type'       => 'object',
    		'properties' => array(
    			'id'              => array(
    				'description' => __( 'ID of template.' ),
    				'type'        => 'string',
    				'context'     => array( 'embed', 'view', 'edit' ),
    				'readonly'    => true,
    			),
    			'slug'            => array(
    				'description' => __( 'Unique slug identifying the template.' ),
    				'type'        => 'string',
    				'context'     => array( 'embed', 'view', 'edit' ),
    				'required'    => true,
    				'minLength'   => 1,
    				'pattern'     => '[a-zA-Z0-9_\%-]+',
    			),
    			'theme'           => array(
    				'description' => __( 'Theme identifier for the template.' ),
    				'type'        => 'string',
    				'context'     => array( 'embed', 'view', 'edit' ),
    			),
    			'type'            => array(
    				'description' => __( 'Type of template.' ),
    				'type'        => 'string',
    				'context'     => array( 'embed', 'view', 'edit' ),
    			),
    			'source'          => array(
    				'description' => __( 'Source of template' ),
    				'type'        => 'string',
    				'context'     => array( 'embed', 'view', 'edit' ),
    				'readonly'    => true,
    			),
    			'origin'          => array(
    				'description' => __( 'Source of a customized template' ),
    				'type'        => 'string',
    				'context'     => array( 'embed', 'view', 'edit' ),
    				'readonly'    => true,
    			),
    			'content'         => array(
    				'description' => __( 'Content of template.' ),
    				'type'        => array( 'object', 'string' ),
    				'default'     => '',
    				'context'     => array( 'embed', 'view', 'edit' ),
    				'properties'  => array(
    					'raw'           => array(
    						'description' => __( 'Content for the template, as it exists in the database.' ),
    						'type'        => 'string',
    						'context'     => array( 'view', 'edit' ),
    					),
    					'block_version' => array(
    						'description' => __( 'Version of the content block format used by the template.' ),
    						'type'        => 'integer',
    						'context'     => array( 'edit' ),
    						'readonly'    => true,
    					),
    				),
    			),
    			'title'           => array(
    				'description' => __( 'Title of template.' ),
    				'type'        => array( 'object', 'string' ),
    				'default'     => '',
    				'context'     => array( 'embed', 'view', 'edit' ),
    				'properties'  => array(
    					'raw'      => array(
    						'description' => __( 'Title for the template, as it exists in the database.' ),
    						'type'        => 'string',
    						'context'     => array( 'view', 'edit', 'embed' ),
    					),
    					'rendered' => array(
    						'description' => __( 'HTML title for the template, transformed for display.' ),
    						'type'        => 'string',
    						'context'     => array( 'view', 'edit', 'embed' ),
    						'readonly'    => true,
    					),
    				),
    			),
    			'description'     => array(
    				'description' => __( 'Description of template.' ),
    				'type'        => 'string',
    				'default'     => '',
    				'context'     => array( 'embed', 'view', 'edit' ),
    			),
    			'status'          => array(
    				'description' => __( 'Status of template.' ),
    				'type'        => 'string',
    				'enum'        => array_keys( get_post_stati( array( 'internal' => false ) ) ),
    				'default'     => 'publish',
    				'context'     => array( 'embed', 'view', 'edit' ),
    			),
    			'wp_id'           => array(
    				'description' => __( 'Post ID.' ),
    				'type'        => 'integer',
    				'context'     => array( 'embed', 'view', 'edit' ),
    				'readonly'    => true,
    			),
    			'has_theme_file'  => array(
    				'description' => __( 'Theme file exists.' ),
    				'type'        => 'bool',
    				'context'     => array( 'embed', 'view', 'edit' ),
    				'readonly'    => true,
    			),
    			'author'          => array(
    				'description' => __( 'The ID for the author of the template.' ),
    				'type'        => 'integer',
    				'context'     => array( 'view', 'edit', 'embed' ),
    			),
    			'modified'        => array(
    				'description' => __( "The date the template was last modified, in the site's timezone." ),
    				'type'        => 'string',
    				'format'      => 'date-time',
    				'context'     => array( 'view', 'edit' ),
    				'readonly'    => true,
    			),
    			'author_text'     => array(
    				'type'        => 'string',
    				'description' => __( 'Human readable text for the author.' ),
    				'readonly'    => true,
    				'context'     => array( 'view', 'edit', 'embed' ),
    			),
    			'original_source' => array(
    				'description' => __( 'Where the template originally comes from e.g. \'theme\'' ),
    				'type'        => 'string',
    				'readonly'    => true,
    				'context'     => array( 'view', 'edit', 'embed' ),
    				'enum'        => array(
    					'theme',
    					'plugin',
    					'site',
    					'user',
    				),
    			),
    		),
    	);

    	if ( 'wp_template' === $this->post_type ) {
    		$schema['properties']['is_custom'] = array(
    			'description' => __( 'Whether a template is a custom template.' ),
    			'type'        => 'bool',
    			'context'     => array( 'embed', 'view', 'edit' ),
    			'readonly'    => true,
    		);
    		$schema['properties']['plugin']    = array(
    			'type'        => 'string',
    			'description' => __( 'Plugin that registered the template.' ),
    			'readonly'    => true,
    			'context'     => array( 'view', 'edit', 'embed' ),
    		);
    	}

    	if ( 'wp_template_part' === $this->post_type ) {
    		$schema['properties']['area'] = array(
    			'description' => __( 'Where the template part is intended for use (header, footer, etc.)' ),
    			'type'        => 'string',
    			'context'     => array( 'embed', 'view', 'edit' ),
    		);
    	}

    	$this->schema = $schema;

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php#L1037)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php#L1037-L1205)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#related)󠁿

| Uses | Description | 
| [get_post_stati()](https://developer.wordpress.org/reference/functions/get_post_stati/)`wp-includes/post.php` |

Gets a list of post statuses.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_templates_controller/get_item_schema/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Added `'area'`. | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_templates_controller%2Fget_item_schema%2F)
before being able to contribute a note or feedback.