WP_REST_Meta_Fields::get_field_schema(): array

In this article

Retrieves the object’s meta schema, conforming to JSON Schema.

Return

array Field schema data.

Source

public function get_field_schema() {
	$fields = $this->get_registered_fields();

	$schema = array(
		'description' => __( 'Meta fields.' ),
		'type'        => 'object',
		'context'     => array( 'view', 'edit' ),
		'properties'  => array(),
		'arg_options' => array(
			'sanitize_callback' => null,
			'validate_callback' => array( $this, 'check_meta_is_array' ),
		),
	);

	foreach ( $fields as $args ) {
		$schema['properties'][ $args['name'] ] = $args['schema'];
	}

	return $schema;
}

Changelog

VersionDescription
4.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.