Multiplile values checkbox or select in custom meta box

In his answer , Jan Fabry made a brilliant solution, but it saves the values one by one (for each his own field )

for your question, we need to “reverse” that , but it is actually easy .

BEFORE lines 409-413 , Jan Fabry made an if-else clause to seperate values into fields and save / update. we do not need it .

Instead , we take the already constructed array and save it as a whole.
so you just need to add this instead of the whole bigger clause (and do not forget to drop the ELSE:

  if ( 'multicheck' == $field['type'] ) {
        // If it is a multicheck , implode the array and get a string...
    $new =implode(",", $new);
    } 

That´s all .
and do not foget to thatnk JAN Fabry for it – not me 🙂

Leave a Comment