acf_field_select::update_field
Filters the $field before it is saved to the database.
Method of the class: acf_field_select{}
No Hooks.
Returns
Array.
Usage
$acf_field_select = new acf_field_select(); $acf_field_select->update_field( $field );
- $field(array) (required)
- The field array holding all the field options.
Changelog
| Since 3.6 | Introduced. |
acf_field_select::update_field() acf field select::update field code ACF 6.8.8
public function update_field( $field ) {
// Decode choices (convert to array).
$field['choices'] = acf_decode_choices( $field['choices'] );
$field['default_value'] = acf_decode_choices( $field['default_value'], true );
// Convert back to string for single selects.
if ( ! $field['multiple'] ) {
$field['default_value'] = acf_unarray( $field['default_value'] );
}
return $field;
}