Reply To: Checklist Field Displays as Array

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Checklist Field Displays as Array Reply To: Checklist Field Displays as Array

#5847

Ernest Marcinko
Keymaster

You are welcome!

Indeed, I made a syntax error there.

For future reference the correct code:

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;
}
Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)