WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_REST_Controller::update_additional_fields_for_object() WP 4.7.0

Updates the values of additional fields added to a data object.

Это метод класса: WP_REST_Controller

Хуков нет.

Возвращает

true/false/WP_Error. True on success, WP_Error object if a field cannot be updated.

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

$WP_REST_Controller = new WP_REST_Controller();
$var = $WP_REST_Controller->update_additional_fields_for_object( $object, $request );
$object(массив) (обязательный)
Data Object.
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код WP REST Controller::update additional fields for object: wp-includes/rest-api/endpoints/class-wp-rest-controller.php WP 5.2.2

<?php
protected function update_additional_fields_for_object( $object, $request ) {
	$additional_fields = $this->get_additional_fields();

	foreach ( $additional_fields as $field_name => $field_options ) {
		if ( ! $field_options['update_callback'] ) {
			continue;
		}

		// Don't run the update callbacks if the data wasn't passed in the request.
		if ( ! isset( $request[ $field_name ] ) ) {
			continue;
		}

		$result = call_user_func( $field_options['update_callback'], $request[ $field_name ], $object, $field_name, $request, $this->get_object_type() );

		if ( is_wp_error( $result ) ) {
			return $result;
		}
	}

	return true;
}