WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a custom post type with many custom meta boxes and data. Let's say that i want to add 50 custom post variables.

I see in the db that for every post meta variable a record is inserted in wp_postmeta. That said , a single post creation will result in 50 different inserts in wp_postmeta. That means that if i have 1000 posts in the db what will happen if i make a conditional query?

Is this efficient or is there another way?


share|improve this question
"efficient" for what exactly? You can do a lot right and a lot pretty wrong. Show us your queries, then we can (maybe) tell. – kaiser May 7 '12 at 12:50

As the reading of the database is lightning fast, I would not worry too much about it.

You have got a few points to consider:

  1. If you want to have all your metavalues queryable by the standard wordpress queries, you have to save them into different records.
  2. If you have a big, standardized set of custom values, maybe you should consider creating your own table, linking to the postId, storing all your metavalues. Keep in mind that you will have to write your own queries in this case.
  3. If you do it the standard wordpress way, you have a predefined set of functions helping you to deal with the metadata - you should find get_post_custom() a very useful one to output your values.

I do not know exactly what you want to do with your data - so if you could specify your problem, we could help you a little better.

share|improve this answer

Your Answer


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.