Introduction to WordPress Database: wp_postmeta

Introduction to WordPress Database: wp_postmeta

Current Version : 2.9.2

Just like wp_options and wp_usermeta, wp_postmeta is used to save post related data. These data are generally called custom fields.

One can add custom field from post editor, as shown below:

For example, I have the inserted version in each post using the custom fields.

The structure of this table is as follows:

Field Type Null Key Default Extra
meta_id bigint(20) unsigned PRI NULL auto_increment
post_id bigint(20) unsigned IND 0 FK->wp_posts.ID
meta_key varchar(255) YES IND NULL
meta_value longtext YES NULL

Indexes

Keyname Type Cardinality Field
PRIMARY PRIMARY 13 meta_ID
post_id INDEX 15 post_id
meta_key INDEX 7 meta_key

In the table, the value is saved with meta_key and post id.

These fields can be handled using various functions like add_post_meta(),update_post_meta(),get_post_custom() etc. Please check this URL for more details:

http://codex.wordpress.org/Custom_Fields

You may like these articles :

  1. Introduction to WordPress Database: wp_commentmeta Introduction to WordPress Database: wp_commentmeta Current Version: 2.9.2 Each comment...
  2. Introduction to WordPress Database: wp_usermeta Introduction to WordPress Database: wp_usermeta Current Version: 2.9.2 In general,...
  3. Introduction to WordPress Database: wp_comments Introduction to WordPress Database: wp_comments Current Version : 2.9.2 Comments...
  4. Introduction to wordpress database: wp_posts Well, this is the most important table in wordpress structure....
  5. Introduction to WordPress Database: wp_links In the structure of wordpress database, this is the LEAST...

-

Leave a Reply