dave
dave

Reputation: 15459

What is the wp_postmeta table

From my understanding, the wp_postmeta extends the schema for wp_post. So basically the standard fields/structure for a post will be found in wp_posts, and if any post(s) needed their own set of fields/attributes etc, they would be defined in wp_postmeta table. So I wanted to know if I'm right about this or not?

thanks.

Upvotes: 9

Views: 40286

Answers (2)

Blackbam
Blackbam

Reputation: 19366

Have a look at this: https://codex.wordpress.org/images/2/2a/WP3.9.4-ERD.png

wp_postmeta (similar to wp_usermeta for users and wp_commentmenta for comments) stores any additional information which is connected to a post somehow especially user-defined.

Use the functions

add_post_meta()
update_post_meta()
get_post_meta()

which are already implementing object and array serialization/deserialization (and a lot of more) in order to store custom information which is not stored within the wp_posts table.

Upvotes: 8

user4011800
user4011800

Reputation:

You are absolutely right. If there exist some meta box or "own set of fields/attributes" wp_postmeta table will store those field's values.

Upvotes: 12

Related Questions