This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Checklist Field Displays as Array

#5847
Ernest MarcinkoErnest Marcinko
Keymaster

You are welcome!

Indeed, I made a syntax error there.

For future reference the correct code:

[php]
add_filter( ‘asp_results’, ‘asp_checkbox_to_results’, 1, 1 );

function asp_checkbox_to_results( $results ) {
foreach ($results as $k=>$v) {
// Get the field
$checkboxes = get_field(‘my_checkbox_list’, $v->id);
// Append if exists
if( $checkboxes ){
$checkbox_string = implode(‘, ‘, $checkboxes);
$results[$k]->content .= " – " . $checkbox_string;
}
}

return $results;
}
[/php]