acf_field_file::update_valuepublicACF 3.6

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

Method of the class: acf_field_file{}

No Hooks.

Returns

$value. - the modified value

Usage

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

Changelog

Since 3.6 Introduced.

acf_field_file::update_value() code ACF 6.8.8

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

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

	// Parse value for id.
	$attachment_id = acf_idval( $value );

	// Connect attacment to post.
	acf_connect_attachment_to_post( $attachment_id, $post_id );

	// Return id.
	return $attachment_id;
}