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.

I would like to store a few extra details for my custom post type, using meta boxes. Should I store all the values under one meta key in an array, or create several meta key and value pairs?

share|improve this question
    
Please define your "few extra details". –  Chip Bennett Aug 20 '12 at 16:02
add comment

1 Answer

up vote 1 down vote accepted

If you want to use the values to sort or filter the data, you should keep them as separate entries.

share|improve this answer
    
and if not, I should use an array? Does it improve performance or have any other benefit? –  drtanz Aug 20 '12 at 13:18
    
I don't know if it improves performance or not. –  nvwd Aug 20 '12 at 13:54
    
ok, I'll wait for other responses then, thanks. –  drtanz Aug 20 '12 at 13:57
2  
meta data are intended to be discrete key => value pairs. You should store them as such. You gain no performance improvements by trying to force them into an array. –  Chip Bennett Aug 20 '12 at 16:03
    
Thanks Chip, that's what I was looking for. –  drtanz Aug 20 '12 at 17:12
add comment

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.