acf_field__group::update_value
This filter is appied to the $value before it is updated in the db
Метод класса: acf_field__group{}
Хуков нет.
Возвращает
$value. - the modified value
Использование
$acf_field__group = new acf_field__group(); $acf_field__group->update_value( $value, $post_id, $field );
- $value(обязательный)
- .
- $post_id(обязательный)
- .
- $field(обязательный)
- .
Список изменений
| С версии 3.6 | Введена. |
Код acf_field__group::update_value() acf field group::update value ACF 6.4.2
function update_value( $value, $post_id, $field ) {
// bail early if no value
if ( ! acf_is_array( $value ) ) {
return null;
}
// bail early if no sub fields
if ( empty( $field['sub_fields'] ) ) {
return null;
}
// modify names
$field = $this->prepare_field_for_db( $field );
// loop
foreach ( $field['sub_fields'] as $sub_field ) {
// vars
$v = false;
// key (backend)
if ( isset( $value[ $sub_field['key'] ] ) ) {
$v = $value[ $sub_field['key'] ];
// name (frontend)
} elseif ( isset( $value[ $sub_field['_name'] ] ) ) {
$v = $value[ $sub_field['_name'] ];
// empty
} else {
// input is not set (hidden by conditioanl logic)
continue;
}
// update value
acf_update_value( $v, $post_id, $sub_field );
}
// return
return '';
}