Home Forums General Issues Convert field type radio to checkbox


Convert field type radio to checkbox

  • How it’s possible convert a field type with datas and preserve them?

  • 1) Copy the choices value
    2) Change the field type
    3) Paste the choices value

    Do not change the field name

    ACF will detect this change in the admin and values will be preserved when the post is next edited.

    This may or may not be reflected on the front end of the site. A radio field holds a single value and a checkbox stores an array. You may need to do some checking and correction in your template, but you’ll need to test it.

    $value = get_field('your field name');
    if (!empty($value) && !is_array($value) {
      $value = array($value);
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Convert field type radio to checkbox’ is closed to new replies.