Title: WP_REST_Blocks_Controller::get_item_schema
Published: December 6, 2018
Last modified: February 24, 2026

---

# WP_REST_Blocks_Controller::get_item_schema(): array

## In this article

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

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

Retrieves the pattern’s schema, conforming to JSON Schema.

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

 array Item schema data.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_blocks_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 = parent::get_item_schema();

    	/*
    	 * Allow all contexts to access `title.raw` and `content.raw`.
    	 * Clients always need the raw markup of a pattern to do anything useful,
    	 * e.g. parse it or display it in an editor.
    	 */
    	$schema['properties']['title']['properties']['raw']['context']   = array( 'view', 'edit' );
    	$schema['properties']['content']['properties']['raw']['context'] = array( 'view', 'edit' );

    	/*
    	 * Remove `title.rendered` and `content.rendered` from the schema.
    	 * It doesn't make sense for a pattern to have rendered content on its own,
    	 * since rendering a block requires it to be inside a post or a page.
    	 */
    	unset( $schema['properties']['title']['properties']['rendered'] );
    	unset( $schema['properties']['content']['properties']['rendered'] );

    	$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-blocks-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php#L73)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php#L73-L99)

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

| Uses | Description | 
| [WP_REST_Posts_Controller::get_item_schema()](https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/get_item_schema/)`wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php` |

Retrieves the post’s schema, conforming to JSON Schema.

  |

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

| Version | Description | 
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.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_blocks_controller%2Fget_item_schema%2F)
before being able to contribute a note or feedback.