acf_field_select::format_value
Filters the $value after it is loaded from the db, and before it is returned to the template.
Method of the class: acf_field_select{}
No Hooks.
Returns
Mixed.
Usage
$acf_field_select = new acf_field_select(); $acf_field_select->format_value( $value, $post_id, $field );
- $value(mixed) (required)
- The value which was loaded from the database.
- $post_id(int|string) (required)
- The post_id from which the value was loaded.
- $field(array) (required)
- The field array holding all the field options.
Changelog
| Since 3.6 | Introduced. |
acf_field_select::format_value() acf field select::format value code ACF 6.8.8
public function format_value( $value, $post_id, $field ) {
if ( is_array( $value ) ) {
foreach ( $value as $i => $val ) {
$value[ $i ] = $this->format_value_single( $val, $post_id, $field );
}
} else {
$value = $this->format_value_single( $value, $post_id, $field );
}
return $value;
}