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;