acf/rest/format_value_for_rest
Filter the formatted value for a given field.
Использование
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(разное)
- The formatted value.
- $post_id(строка|int)
- The post ID of the current object.
- $field(массив)
- The field array.
- $value(разное)
- The raw/unformatted value.
- $format(строка)
- The format applied to the field value.
Где вызывается хук
acf/rest/format_value_for_rest
acf/includes/rest-api/acf-rest-api-functions.php 86
return apply_filters( 'acf/rest/format_value_for_rest', $value_formatted, $post_id, $field, $value, $format );