acf_form_customizer::pre_update_option()publicACF 5.3.2

pre_update_option

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

Метод класса: acf_form_customizer{}

Хуков нет.

Возвращает

$post_id. (int)

Использование

$acf_form_customizer = new acf_form_customizer();
$acf_form_customizer->pre_update_option( $value, $option, $old_value );
$value (обязательный)
-
$option (обязательный)
-
$old_value (обязательный)
-

Список изменений

С версии 5.3.2 Введена.

Код acf_form_customizer::pre_update_option() 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;

}