acf_field_radio::update_value()
This filter is appied to the $value before it is updated in the db
Метод класса: acf_field_radio{}
Хуков нет.
Возвращает
$value
. - the modified value
Использование
$acf_field_radio = new acf_field_radio(); $acf_field_radio->update_value( $value, $post_id, $field );
- $value (обязательный)
- -
- $post_id (обязательный)
- -
- $field (обязательный)
- -
Список изменений
С версии 3.6 | Введена. |
Код acf_field_radio::update_value() acf field radio::update value ACF 6.0.4
function update_value( $value, $post_id, $field ) { // bail early if no value (allow 0 to be saved) if ( ! $value && ! is_numeric( $value ) ) { return $value; } // save_other_choice if ( $field['save_other_choice'] ) { // value isn't in choices yet if ( ! isset( $field['choices'][ $value ] ) ) { // get raw $field (may have been changed via repeater field) // if field is local, it won't have an ID $selector = $field['ID'] ? $field['ID'] : $field['key']; $field = acf_get_field( $selector ); // bail early if no ID (JSON only) if ( ! $field['ID'] ) { return $value; } // unslash (fixes serialize single quote issue) $value = wp_unslash( $value ); // sanitize (remove tags) $value = sanitize_text_field( $value ); // update $field $field['choices'][ $value ] = $value; // save acf_update_field( $field ); } } // return return $value; }