acf/rest/format_value_for_rest
Filter the formatted value for a given field.
Usage
add_filter( 'acf/rest/format_value_for_rest', 'wp_kama_acf_rest_format_value_for_filter', 10, 5 );
/**
* Function for `acf/rest/format_value_for_rest` filter-hook.
*
* @param mixed $value_formatted The formatted value.
* @param string|int $post_id The post ID of the current object.
* @param array $field The field array.
* @param mixed $value The raw/unformatted value.
* @param string $format The format applied to the field value.
*
* @return mixed
*/
function wp_kama_acf_rest_format_value_for_filter( $value_formatted, $post_id, $field, $value, $format ){
// filter...
return $value_formatted;
}
- $value_formatted(mixed)
- The formatted value.
- $post_id(string|int)
- The post ID of the current object.
- $field(array)
- The field array.
- $value(mixed)
- The raw/unformatted value.
- $format(string)
- The format applied to the field value.
Where the hook is called
acf/rest/format_value_for_rest
acf/includes/rest-api/acf-rest-api-functions.php 87
return apply_filters( 'acf/rest/format_value_for_rest', $value_formatted, $post_id, $field, $value, $format );