What is the best way to store post meta in an array (using a custom write box, know how to do that) so that all post meta is in a single custom field?

1 Answer 1


From codex:

$meta_value (mixed) (required) The value of the custom field you will add. An array will be serialized into a string. Default: None

So <?php add_post_meta(7, 'fruit', 'banana', 'apple', 'tornado', 'bob saget')

To grab them you can also use http://codex.wordpress.org/Function_Reference/get_post_custom_values

besides just get_post_meta.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.