acf_field_checkbox::format_value
This filter is appied to the $value after it is loaded from the db and before it is returned to the template
Method of the class: acf_field_checkbox{}
No Hooks.
Returns
$value. (mixed) the modified value
Usage
$acf_field_checkbox = new acf_field_checkbox(); $acf_field_checkbox->format_value( $value, $post_id, $field );
- $value(required)
- .
- $post_id(required)
- .
- $field(required)
- .
Changelog
| Since 3.6 | Introduced. |
acf_field_checkbox::format_value() acf field checkbox::format value code ACF 6.0.4
function format_value( $value, $post_id, $field ) {
// Bail early if is empty.
if ( acf_is_empty( $value ) ) {
return array();
}
// Always convert to array of items.
$value = acf_array( $value );
// Return.
return acf_get_field_type( 'select' )->format_value( $value, $post_id, $field );
}