Home › Forums › General Issues › Check Box Output Commas › Reply To: Check Box Output Commas
I’m trying to see if ACF is formatting the value of $field[‘value’];
add_filter('acf/format_value/name=myfield', 'my_format_checkbox_field_function', 20, 3);
function my_format_checkbox_field_function($value, $post_id, $field) {
$value = $field['value'];
// return the value here so you can see what it is
// this is temporary, let me know what gets output to the page
return $value
$values = array();
foreach ($value as $item) {
if (isset($field['choices'][$item])) {
$values[] = $field['choices'][ $item ];
} else {
$values[] = $item;
}
}
$value = implode('<br>', $values);
return $value;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.