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'm researching the structure of WordPress database and there is something that really get me confuesd. Could someone please explain, what is the exact job of meta_key and meta_value fields in wp_commentmeta, wp_postmeta, wp_usermeta tables? What is the job of these tables anyway?

I did read the Database Description in the Codex, but still don't get it.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Think of them as array key/value pairs (kinda). These tables are used to store additional data about particular posts, comments, or users. The meta_key is the name by which the meta_value is retrieved, plus you have associations with particular posts, comments, or users by means of IDs. As far as structure goes, that is about it. These are "extra info" tables. You can even add to them via the backend. *_postmeta is where the custom fields are stored.

WordPress stores, and plugins and themes can store, a wide variety or information there. Some of those tables have critical information, like role/capability data, but you may also have relatively trivial data like someone's Jabber handle (Is that even around anymore?), or a favorite color.

share|improve this answer
    
First Thank you for your concern :) and what is the difference of these tables and the wp_comments or wp_users... ? aren't they enough to store the data wp needs? –  Daniel Dec 28 '12 at 0:34
    
wp_comments, wp_posts, and wp_users store a very particular collection of specific information. If you want to store something that isn't in that specific set you need to put it elsewhere, or keep adding column after column to table. WordPress does the former (and I approve :) ). –  s_ha_dum Dec 28 '12 at 0:37
    
ow now i get it ! thanks a lot. you were a great help :) –  Daniel Dec 28 '12 at 0:42
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.