Title: WP_REST_Block_Directory_Controller::get_item_schema
Published: August 11, 2020
Last modified: May 20, 2026

---

# WP_REST_Block_Directory_Controller::get_item_schema(): array

## In this article

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

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

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

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

 array Item schema data.

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

    	$this->schema = array(
    		'$schema'    => 'http://json-schema.org/draft-04/schema#',
    		'title'      => 'block-directory-item',
    		'type'       => 'object',
    		'properties' => array(
    			'name'                => array(
    				'description' => __( 'The block name, in namespace/block-name format.' ),
    				'type'        => 'string',
    				'context'     => array( 'view' ),
    			),
    			'title'               => array(
    				'description' => __( 'The block title, in human readable format.' ),
    				'type'        => 'string',
    				'context'     => array( 'view' ),
    			),
    			'description'         => array(
    				'description' => __( 'A short description of the block, in human readable format.' ),
    				'type'        => 'string',
    				'context'     => array( 'view' ),
    			),
    			'id'                  => array(
    				'description' => __( 'The block slug.' ),
    				'type'        => 'string',
    				'context'     => array( 'view' ),
    			),
    			'rating'              => array(
    				'description' => __( 'The star rating of the block.' ),
    				'type'        => 'number',
    				'context'     => array( 'view' ),
    			),
    			'rating_count'        => array(
    				'description' => __( 'The number of ratings.' ),
    				'type'        => 'integer',
    				'context'     => array( 'view' ),
    			),
    			'active_installs'     => array(
    				'description' => __( 'The number sites that have activated this block.' ),
    				'type'        => 'integer',
    				'context'     => array( 'view' ),
    			),
    			'author_block_rating' => array(
    				'description' => __( 'The average rating of blocks published by the same author.' ),
    				'type'        => 'number',
    				'context'     => array( 'view' ),
    			),
    			'author_block_count'  => array(
    				'description' => __( 'The number of blocks published by the same author.' ),
    				'type'        => 'integer',
    				'context'     => array( 'view' ),
    			),
    			'author'              => array(
    				'description' => __( 'The WordPress.org username of the block author.' ),
    				'type'        => 'string',
    				'context'     => array( 'view' ),
    			),
    			'icon'                => array(
    				'description' => __( 'The block icon.' ),
    				'type'        => 'string',
    				'format'      => 'uri',
    				'context'     => array( 'view' ),
    			),
    			'last_updated'        => array(
    				'description' => __( 'The date when the block was last updated.' ),
    				'type'        => 'string',
    				'format'      => 'date-time',
    				'context'     => array( 'view' ),
    			),
    			'humanized_updated'   => array(
    				'description' => __( 'The date when the block was last updated, in human readable format.' ),
    				'type'        => 'string',
    				'context'     => array( 'view' ),
    			),
    		),
    	);

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

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

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

Retrieves the translation of $text.

  |

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

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