WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have followed the great answer by Jan Fabry in this question .

How to make multicheck for post/page meta box

this works great. My question though would be , what if someone WANTS a serialized value (array e.g. :"banana,apple,grapes" in ONE field ? ) and not separate values ?

It is strange how in all the tutorials, example, and classes, everyone ignores multiple selection (also in select list)

share|improve this question
up vote 0 down vote accepted

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 :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.