acf_field_gallery::update_valuepublicACF 3.6

This filter is appied to the $value before it is updated in the db

Method of the class: acf_field_gallery{}

No Hooks.

Returns

$value. - the modified value

Usage

$acf_field_gallery = new acf_field_gallery();
$acf_field_gallery->update_value( $value, $post_id, $field );
$value(required)
.
$post_id(required)
.
$field(required)
.

Changelog

Since 3.6 Introduced.

acf_field_gallery::update_value() code ACF 6.0.4

function update_value( $value, $post_id, $field ) {

	// Bail early if no value.
	if ( empty( $value ) ) {
		return $value;
	}

	// Convert to array.
	$value = acf_array( $value );

	// Format array of values.
	// - ensure each value is an id.
	// - Parse each id as string for SQL LIKE queries.
	$value = array_map( 'acf_idval', $value );
	$value = array_map( 'strval', $value );

	// Return value.
	return $value;

}