Home › Forums › General Issues › Convert field type radio to checkbox › Reply To: Convert field type radio to checkbox
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);
}
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.