Viewing 2 reply threads
  • Author
    Posts
    • #6937
      bshep
      Member

      Is is possible to store checkbox options as a serialized array? I have a list of checkboxes that is currently saving multiple meta value entries with the same meta_key – I’d like it to save as a single row with serialized values.

    • #6938
      Steve
      Keymaster

      @bshep– You could save the field as a group field, with the checkbox field being the only field in the group.

      OR

      You can just leave it the way it is, and use get_post_meta() with the last parameter set to false. This would give you the data back as an array: get_post_meta(get_the_ID(), 'my_field', false)

      Piklist saves it like this because the data is flexible. If you want to query on the data you can. Saving it as a serialized array removes the ability to query it.

    • #6941
      bshep
      Member

      Thanks – the reason I needed the array is that I’m using the Admin Columns plugin to show my site admins a column with multiple values, and Admin Columns’ “multiple values” setting only works with an array. As far as other use, I’m fine with the way it is.

Viewing 2 reply threads
  • The topic ‘Serialize checkbox data’ is closed to new replies.