Title: WP_REST_Font_Families_Controller::get_item_schema
Published: April 3, 2024
Last modified: April 28, 2025

---

# WP_REST_Font_Families_Controller::get_item_schema(): array

## In this article

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

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

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

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

 array Item schema data.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_font_families_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',
    		// Base properties for every Post.
    		'properties' => array(
    			'id'                   => array(
    				'description' => __( 'Unique identifier for the post.', 'default' ),
    				'type'        => 'integer',
    				'context'     => array( 'view', 'edit', 'embed' ),
    				'readonly'    => true,
    			),
    			'theme_json_version'   => array(
    				'description' => __( 'Version of the theme.json schema used for the typography settings.' ),
    				'type'        => 'integer',
    				'default'     => static::LATEST_THEME_JSON_VERSION_SUPPORTED,
    				'minimum'     => 2,
    				'maximum'     => static::LATEST_THEME_JSON_VERSION_SUPPORTED,
    				'context'     => array( 'view', 'edit', 'embed' ),
    			),
    			'font_faces'           => array(
    				'description' => __( 'The IDs of the child font faces in the font family.' ),
    				'type'        => 'array',
    				'context'     => array( 'view', 'edit', 'embed' ),
    				'items'       => array(
    					'type' => 'integer',
    				),
    			),
    			// Font family settings come directly from theme.json schema
    			// See https://schemas.wp.org/trunk/theme.json
    			'font_family_settings' => array(
    				'description'          => __( 'font-face definition in theme.json format.' ),
    				'type'                 => 'object',
    				'context'              => array( 'view', 'edit', 'embed' ),
    				'properties'           => array(
    					'name'       => array(
    						'description' => __( 'Name of the font family preset, translatable.' ),
    						'type'        => 'string',
    						'arg_options' => array(
    							'sanitize_callback' => 'sanitize_text_field',
    						),
    					),
    					'slug'       => array(
    						'description' => __( 'Kebab-case unique identifier for the font family preset.' ),
    						'type'        => 'string',
    						'arg_options' => array(
    							'sanitize_callback' => 'sanitize_title',
    						),
    					),
    					'fontFamily' => array(
    						'description' => __( 'CSS font-family value.' ),
    						'type'        => 'string',
    						'arg_options' => array(
    							'sanitize_callback' => array( 'WP_Font_Utils', 'sanitize_font_family' ),
    						),
    					),
    					'preview'    => array(
    						'description' => __( 'URL to a preview image of the font family.' ),
    						'type'        => 'string',
    						'format'      => 'uri',
    						'default'     => '',
    						'arg_options' => array(
    							'sanitize_callback' => 'sanitize_url',
    						),
    					),
    				),
    				'required'             => array( 'name', 'slug', 'fontFamily' ),
    				'additionalProperties' => false,
    			),
    		),
    	);

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

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_font_families_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.

  |

| Used by | Description | 
| [WP_REST_Font_Families_Controller::get_endpoint_args_for_item_schema()](https://developer.wordpress.org/reference/classes/wp_rest_font_families_controller/get_endpoint_args_for_item_schema/)`wp-includes/rest-api/endpoints/class-wp-rest-font-families-controller.php` |

Get the arguments used when creating or updating a font family.

  | 
| [WP_REST_Font_Families_Controller::validate_font_family_settings()](https://developer.wordpress.org/reference/classes/wp_rest_font_families_controller/validate_font_family_settings/)`wp-includes/rest-api/endpoints/class-wp-rest-font-families-controller.php` |

Validates settings when creating or updating a font family.

  | 
| [WP_REST_Font_Families_Controller::sanitize_font_family_settings()](https://developer.wordpress.org/reference/classes/wp_rest_font_families_controller/sanitize_font_family_settings/)`wp-includes/rest-api/endpoints/class-wp-rest-font-families-controller.php` |

Sanitizes the font family settings when creating or updating a font family.

  |

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

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