WP_REST_Meta_Fields::get_field_schema()publicWP 4.7.0

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

Метод класса: WP_REST_Meta_Fields{}

Хуков нет.

Возвращает

Массив. Field schema data.

Использование

$WP_REST_Meta_Fields = new WP_REST_Meta_Fields();
$WP_REST_Meta_Fields->get_field_schema();

Список изменений

С версии 4.7.0 Введена.

Код WP_REST_Meta_Fields::get_field_schema() WP 6.5.2

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;
}