acf_field_post_object::update_valuepublicACF 3.6

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

Method of the class: acf_field_post_object{}

No Hooks.

Returns

$value. - the modified value

Usage

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

Changelog

Since 3.6 Introduced.

acf_field_post_object::update_value() code ACF 6.0.4

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

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

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

		// Parse single value for id.
	} else {
		$value = acf_idval( $value );
	}

	// Return value.
	return $value;
}