Answer the question
In order to leave comments, you need to log in
Advanced Custom Fields - how to merge checkboxes?
There is a wordpress site using the ACF (Advanced Custom Fields) plugin - for creating custom fields in posts.
The bottom line is that there are several checkbox fields in the record, which, when displayed, I need to combine into one select field for the user. There can be many such groups of checkboxes - up to 40.
A poor way of output came to mind:
$field1 = get_field('field1');
$field2 = get_field('field2');
$field3 = get_field('field3');
...
$field40 = get_field('field40);
$fields = array($field1,$field2..$field40);
foreach ($fields as $key => $val)
{
echo '<option value='.'"'.htmlspecialchars($val).'"'.' >'.$val.'</option>';
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question