FANDOM


The following is an outline and description of the database tables created during the standard installation of WordPress V 2.0.3. Currently, the only database supported by WordPress is MySQL version 3.23.23 or greater.

Also note, an extended description of the database for WordPress 2 is under construction.

Because WordPress interfaces with this database by itself, you as an end user, shouldn't have to worry much about its structure. If you're Writing a Plugin, however, you may be interested in learning how to interface with the database directly. WordPress provides the wpdb Class to make this task easy.

Table 概览编辑

这一章是 WordPress 标准安装过程创建的所有表的一个概述。It is followed by specific information of what is in each table.

WordPress 2.0 Tables (10)
表明 描述 对应的用户接口部分
wp_categories WordPress 的文章分类在表 wp_categories 中设置. 该表包含5列. Refer to Administration Panels >> Manage >> Categories
wp_comments WordPress 的评论存储在表 wp_comments 中. 该表包含 15 列. 评论是文章的阅读者对文章的回应,它由阅读者创建,由管理员管理. Administration Panels >> Manage >> Comments
wp_linkcategories The wp_linkcategories hold the information related to the links entered into the Links_Manager feature of WordPress. It has 13 columns. Administration Panels >> Links >> Link Categories
wp_links The wp_links holds information related to the links entered into the Links_Manager feature of WordPress. It has 14 columns. Administration Panels >> Links >> Manage Links
Administration Panels >> Links >> Add Links
Administration Panels >> Links >> Import Links
wp_options The Options set under the Administration > Options panel are stored in the wp_options table and it has 11 columns. Administration Panels >> Options > > General
Administration Panels >> Options > >Writing
Administration Panels >> Options > >Reading
Administration Panels >> Options > >Discussion
Administration Panels >> Options > >Permalinks
Administration Panels >> Options > >Miscellaneous
wp_post2cat Each post in the wp_posts table is associated with a category from the wp_categories table and this association is maintained in the wp_post2cat table and it has 3 columns. Administration Panels >> Write >> Write Post
Administration Panels >> Manage >> Posts >> Edit
wp_postmeta Each post features information called the meta data and it is stored in the wp_postmeta which has 4 columns.  
wp_posts The core of the WordPress data is the posts. It is stored in the wp_posts table which has 21 columns. Administration Panels >> Write >> Write a Post
wp_usermeta Each user features information called the meta data and it is stored in wp_usermeta which has 4 columns.  
wp_users The list of users is maintained in table.wp_users, which has 22 columns. Administration Panels >> Users


Table 细节编辑

The following are the specific fields in each of the tables created during the standard WordPress installation.

Table: wp_categories编辑

FieldTypeNullKeyDefaultExtra
cat_IDbigint(20) PRINULLauto_increment
cat_namevarchar(55)     
category_nicenamevarchar(200) IND  
category_descriptionlongtext    
category_parentbigint(20)  0FK->wp_categories.cat_ID
category_countbigint(20)  0 

Table: wp_comments编辑

FieldTypeNullKeyDefaultExtra
comment_IDbigint(20) unsigned PRINULLauto_increment
comment_post_IDint(11) IND0FK->wp_posts.ID
comment_authortinytext    
comment_author_emailvarchar(100)    
comment_author_urlvarchar(200)    
comment_author_IPvarchar(100)    
comment_datedatetime  0000-00-00 00:00:00 
comment_date_gmtdatetime  0000-00-00 00:00:00 
comment_contenttext    
comment_karmaint(11)  0 
comment_approvedenum('0','1','spam') IND1 
comment_agentvarchar(255)    
comment_typevarchar(20)    
comment_parentbigint(20)  0FK->wp_comment.ID
user_idbigint(20)  0FK->wp_users.ID

Table: wp_linkcategories编辑

FieldTypeNullKeyDefaultExtra
cat_idbigint(20) PRINULLauto_increment
cat_nametinytext    
auto_toggleenum('Y','N')  N 
show_imagesenum('Y','N')  Y 
show_descriptionenum('Y','N')  N 
show_ratingenum('Y','N')  Y 
show_updatedenum('Y','N')  Y 
sort_ordervarchar(64)  rand 
sort_descenum('Y','N')  N 
text_before_linkvarchar(128)  <li> 
text_after_linkvarchar(128)  <br /> 
text_after_allvarchar(128)  </li> 
list_limitint(11)  -1 


Table: wp_links编辑

FieldTypeNullKeyDefaultExtra
link_idbigint(20) PRINULLauto_increment
link_urlvarchar(255)    
link_namevarchar(255)    
link_imagevarchar(255)    
link_targetvarchar(25)    
link_categorybigint(20) IND0FK->wp_linkcategories.cat_id
link_descriptionvarchar(255)    
link_visibleenum('Y','N') INDY 
link_ownerint(11)  1 
link_ratingint(11)  0 
link_updateddatetime  0000-00-00 00:00:00 
link_relvarchar(255)    
link_notesmediumtext    
link_rssvarchar(255)    


Table: wp_options编辑

FieldTypeNullKeyDefaultExtra
option_idbigint(20) PRINULLauto_increment
blog_idint(11) PRI0 
option_namevarchar(64) PRI&IND  
option_can_overrideenum('Y','N')  Y 
option_typeint(11)  1 
option_valuelongtext   
option_widthint(11)  20 
option_heightint(11)  8 
option_descriptiontinytext   
option_admin_levelint(11)  1 
autoloadenum('yes','no')  yes 


Table: wp_post2cat编辑

FieldTypeNullKeyDefaultExtra
rel_idbigint(20) PRINULLauto_increment
post_idbigint(20) IND Pt10FK->wp_posts.ID
category_idbigint(20) IND Pt20FK->wp_categories.ID


Table: wp_postmeta编辑

FieldTypeNullKeyDefaultExtra
meta_idbigint(20) PRINULLauto_increment
post_idbigint(20) IND0FK->wp_posts.ID
meta_keyvarchar(255)YESINDNULL 
meta_valuelongtextYES NULL 


Table: wp_posts编辑

FieldTypeNullKeyDefaultExtra
IDbigint(20) unsigned PRINULLauto_increment
post_authorbigint(20)  0 
post_datedatetime  0000-00-00 00:00:00 
post_date_gmtdatetime  0000-00-00 00:00:00 
post_contentlongtext    
post_titletext    
post_categoryint(4)  0 
post_excerpttext    
post_statusenum('publish','draft','private','static','object', 'attachment') INDpublish 
comment_statusenum('open','closed','registered_only')  open 
ping_statusenum('open','closed')  open 
post_passwordvarchar(20)    
post_namevarchar(200) IND  
to_pingtext    
pingedtext    
post_modifieddatetime  0000-00-00 00:00:00 
post_modified_gmtdatetime  0000-00-00 00:00:00 
post_content_filteredtext   
post_parentbigint(20)  0FK->wp_posts.ID
guidvarchar(255)    
menu_orderint(11)  0 
post_typevarchar(100)    
post_mime_typevarchar(100)    
comment_countbigint(20)  0 

Table: wp_usermeta编辑

(Added to WP 2.0)

FieldTypeNullKeyDefaultExtra
umeta_idbigint(20) PRINULLauto_increment
user_idbigint(20)  '0'FK->wp_users.ID
meta_keyvarchar(255) INDNULL 
meta_valuelongtext INDNULL 


Table: wp_users编辑

FieldTypeNullKeyDefaultExtra
IDbigint(20) unsigned PRINULLauto_increment
user_loginvarchar(60) UNI & IND  
user_passvarchar(64)    
user_nicenamevarchar(50)    
user_emailvarchar(100)    
user_urlvarchar(100)    
user_registereddatetime  0000-00-00 00:00:00 
user_levelint(2) unsigned  0 
user_activation_keyvarchar(60)   
user_statusint(11)  0 
display_namevarchar(250)