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.

Suppose I store all my post meta data in an array like

$meta = array(
    'img' => '',
    'caption' => ''
);

update_post_meta($post->ID, 'theme_banner', $meta);

Can I query posts where the img is filled?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Short answer: NO!

I've asked a similar question before mysql order by serialized data? and the answer i got is:

The only possible case when serialized data is acceptable is when you don't need to search , filter or order by through that data. In all other cases - store your data as a separated fields.

share|improve this answer

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.