Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
thanks for the example @Wyck –  mattrepublic Jun 9 '11 at 13:40

Your Answer

 
discard

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

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