WordPress at a glance
функция не описана

WP_REST_Settings_Controller::prepare_value() protected WP 4.7.0

Prepares a value for output based off a schema array.

It's a method of the class: WP_REST_Settings_Controller{}

Хуков нет.

Возвращает

Mixed. The prepared value.

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

// protected - for code of main (parent) or child class
$result = $this->prepare_value( $value, $schema );
$value(mixed) (required)
Value to prepare.
$schema(array) (required)
Schema to match.

Changelog

Since 4.7.0 Introduced.

Код WP_REST_Settings_Controller::prepare_value() WP 5.5.1

<?php
protected function prepare_value( $value, $schema ) {
	/*
	 * If the value is not valid by the schema, set the value to null.
	 * Null values are specifically non-destructive, so this will not cause
	 * overwriting the current invalid value to null.
	 */
	if ( is_wp_error( rest_validate_value_from_schema( $value, $schema ) ) ) {
		return null;
	}

	return rest_sanitize_value_from_schema( $value, $schema );
}