/**
* Retrieves the meta field value.
*
* @since 4.7.0
*
* @param int $object_id Object ID to fetch meta for.
* @param WP_REST_Request $request Full details about the request.
* @return array Array containing the meta values keyed by name.
*/
public function get_value( $object_id,
$request ) { $fields =
$this->
get_registered_fields();
$response = array
();
foreach ( $fields as $meta_key =>
$args ) { $name =
$args['name'
];
$all_values =
get_metadata( $this->
get_meta_type(),
$object_id,
$meta_key, false
);
if ( $args['single'
] ) { if ( empty( $all_values ) ) { $value =
$args['schema'
]['default'
];
} else { $value =
$all_values[0
];
}