WordPress at a glance
function is not described

WP_REST_Meta_Fields::prepare_value_for_response() protected WP 4.7.0

Prepares a meta value for a response.

This is required because some native types cannot be stored correctly in the database, such as booleans. We need to cast back to the relevant type before passing back to JSON.

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

No Hooks.

Return

Mixed. Prepared value.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_value_for_response( $value, $request, $args );
$value(mixed) (required)
Meta value to prepare.
$request(WP_REST_Request) (required)
Current request object.
$args(array) (required)
Options for the field.

Changelog

Since 4.7.0 Introduced.

Code of WP_REST_Meta_Fields::prepare_value_for_response() WP 5.5.1

<?php
protected function prepare_value_for_response( $value, $request, $args ) {
	if ( ! empty( $args['prepare_callback'] ) ) {
		$value = call_user_func( $args['prepare_callback'], $value, $request, $args );
	}

	return $value;
}