diff --git a/includes/rest-api/class-acf-rest-api.php b/includes/rest-api/class-acf-rest-api.php index 40005b6b..4c3d7cdc 100644 --- a/includes/rest-api/class-acf-rest-api.php +++ b/includes/rest-api/class-acf-rest-api.php @@ -231,11 +231,11 @@ public function load_fields( $object, $field_name, $request, $object_sub_type ) } // Format the field value according to the request params. - $format = $request->get_param( 'acf_format' ) ?: acf_get_setting( 'rest_api_format' ); - $value = acf_format_value_for_rest( $value, $post_id, $field, $format ); + $format = $request->get_param( 'acf_format' ) ? $request->get_param( 'acf_format' ) : acf_get_setting( 'rest_api_format' ); + $rest_value = acf_format_value_for_rest( $value, $post_id, $field, $format ); // We keep this one for backward compatibility with existing code that expects the field value to be. - $fields[ $field['name'] ] = $value; + $fields[ $field['name'] ] = $rest_value; $fields[ $field['name'] . '_source' ] = array( 'label' => $field['label'], 'type' => $field['type'],