acf_form_customizer::pre_update_optionpublicACF 5.3.2

pre_update_option

this function will remove the [acf] data from widget insance

Method of the class: acf_form_customizer{}

No Hooks.

Returns

$post_id. (int)

Usage

$acf_form_customizer = new acf_form_customizer();
$acf_form_customizer->pre_update_option( $value, $option, $old_value );
$value(required)
.
$option(required)
.
$old_value(required)
.

Changelog

Since 5.3.2 Introduced.

acf_form_customizer::pre_update_option() code ACF 6.0.4

function pre_update_option( $value, $option, $old_value ) {

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

	// loop over widgets
	// WP saves all widgets (of the same type) as an array of widgets
	foreach ( $value as $i => $widget ) {

		// bail early if no acf
		if ( ! isset( $widget['acf'] ) ) {
			continue;
		}

		// remove widget
		unset( $value[ $i ]['acf'] );

	}

	// return
	return $value;

}