“Database Description/2.3”的版本间的差异

来自WordPress中文文档
跳转至: 导航搜索
(1个修订)
第1行: 第1行:
 +
{{Oldpage|2.3}}
 
__TOC__
 
__TOC__
{{Oldpage|2.3}}
 
 
The following is an outline and description of the database tables created during the standard installation of WordPress at [[Version 2.3]].   
 
The following is an outline and description of the database tables created during the standard installation of WordPress at [[Version 2.3]].   
  
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 [[Function_Reference/wpdb Class|wpdb Class]] to make this task easy.
+
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 [[Class_Reference/wpdb|wpdb Class]] to make this task easy.
  
 
= Table Overview =
 
= Table Overview =
 
This section is the overview of all the tables created during the WordPress standard installation.  It is followed by specific information of what is in each table.
 
This section is the overview of all the tables created during the WordPress standard installation.  It is followed by specific information of what is in each table.
  
{| width=75% border=1  
+
{| width="75%" border="1"
|- valign=top
+
|- valign="top"
| colspan=3 bordercolor=#FFFFFF | strongWordPress 2.3 Tables (10)/strong
+
| colspan="3" bordercolor="#FFFFFF" | <strong>WordPress 2.3 Tables (10)</strong>
|- valign=top
+
|- valign="top"
| width=6% | strongTable Name/strong || width=15% | strongDescription/strong || width=15% | strongRelevant Area(s) of WordPress User Interface/strong
+
| width="6%" | <strong>Table Name</strong> || width="15%" | <strong>Description</strong> || width="15%" | <strong>Relevant Area(s) of WordPress User Interface</strong>
|- valign=top
+
|- valign="top"
|  [[#Table:_wp_comments|wp_comments]] || The '''comments''' within WordPress are stored in the ttwp_comments/tt table. || Comments are created by readers as responses to posts. Comments are managed  by administrator via [[Administration Panels]] gt;gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] gt;gt; [[Administration_Panels#Comments|Comments]]
+
|  [[#Table:_wp_comments|wp_comments]] || The '''comments''' within WordPress are stored in the <tt>wp_comments</tt> table. || Comments are created by readers as responses to posts. Comments are managed  by administrator via [[Administration Panels]] &gt;&gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] &gt;&gt; [[Administration_Panels#Comments|Comments]]
|- valign=top
+
|- valign="top"
| [[#Table:_wp_links|wp_links]] || The ttwp_links/tt holds information related to the '''links''' entered  into the [[Manage_Blogroll_SubPanel|Blogroll Manager]] feature of WordPress. || [[Administration Panels]]  gt;gt; [[Administration_Panels#Blogroll_-_Putting_the_Inter_in_the_Internet|Blogroll]] gt;gt; [[Administration_Panels#Manage_Blogroll|Manage Blogroll]]br /  [[Administration Panels]]  gt;gt; [[Administration_Panels#Blogroll_-_Putting_the_Inter_in_the_Internet|Blogroll]] gt;gt; [[Administration_Panels#Add_Link|Add Links]]br /  [[Administration Panels]]  gt;gt; [[Administration_Panels#Blogroll_-_Putting_the_Inter_in_the_Internet|Blogroll]] gt;gt; [[Administration_Panels#Import_Links|Import Links]]
+
| [[#Table:_wp_links|wp_links]] || The <tt>wp_links</tt> holds information related to the '''links''' entered  into the [[Manage_Blogroll_SubPanel|Blogroll Manager]] feature of WordPress. || [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Blogroll_-_Putting_the_Inter_in_the_Internet|Blogroll]] &gt;&gt; [[Administration_Panels#Manage_Blogroll|Manage Blogroll]]<br /> [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Blogroll_-_Putting_the_Inter_in_the_Internet|Blogroll]] &gt;&gt; [[Administration_Panels#Add_Link|Add Links]]<br /> [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Blogroll_-_Putting_the_Inter_in_the_Internet|Blogroll]] &gt;&gt; [[Administration_Panels#Import_Links|Import Links]]
|- valign=top
+
|- valign="top"
|  [[#Table:_wp_options|wp_options]] || The '''[[Administration_Panels#Options_-_Configuration_Settings|Options]]''' set under the '''Administration [[Administration_Panels#Options_-_Configuration_Settings|Options]]''' panel are  stored in the ttwp_options/tt table.  || [[Administration Panels]] gt;gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] gt; gt; [[Administration_Panels#General|General]]br /  [[Administration Panels]] gt;gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] gt; gt;[[Administration_Panels#Writing|Writing]]br /  [[Administration Panels]] gt;gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] gt; gt;[[Administration_Panels#Reading|Reading]]br /  [[Administration Panels]] gt;gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] gt; gt;[[Administration_Panels#Discussion|Discussion]]br /  [[Administration Panels]] gt;gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] gt; gt;[[Administration_Panels#Permalinks|Permalinks]]br /  [[Administration Panels]] gt;gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] gt; gt;[[Administration_Panels#Miscellaneous|Miscellaneous]]
+
|  [[#Table:_wp_options|wp_options]] || The '''[[Administration_Panels#Options_-_Configuration_Settings|Options]]''' set under the '''Administration > [[Administration_Panels#Options_-_Configuration_Settings|Options]]''' panel are  stored in the <tt>wp_options</tt> table.  || [[Administration Panels]] &gt;&gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] &gt; &gt; [[Administration_Panels#General|General]]<br /> [[Administration Panels]] &gt;&gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] &gt; &gt;[[Administration_Panels#Writing|Writing]]<br /> [[Administration Panels]] &gt;&gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] &gt; &gt;[[Administration_Panels#Reading|Reading]]<br /> [[Administration Panels]] &gt;&gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] &gt; &gt;[[Administration_Panels#Discussion|Discussion]]<br /> [[Administration Panels]] &gt;&gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] &gt; &gt;[[Administration_Panels#Permalinks|Permalinks]]<br /> [[Administration Panels]] &gt;&gt; [[Administration_Panels#Options_-_Configuration_Settings|Options]] &gt; &gt;[[Administration_Panels#Miscellaneous|Miscellaneous]]
|- valign=top
+
|- valign="top"
| [[#Table:_wp_postmeta|wp_postmeta]] || Each '''post''' features information called the '''meta data''' and it is  stored in the ttwp_postmeta/tt. Some tag plugins, and other plugins may add their own information to this table. || [[Administration Panels]]  gt;gt; [[Administration_Panels#Write_-_Make_some_content|Write]]  gt;gt; [[Administration_Panels#Write_Post|Write a Post]]
+
| [[#Table:_wp_postmeta|wp_postmeta]] || Each '''post''' features information called the '''meta data''' and it is  stored in the <tt>wp_postmeta</tt>. Some tag plugins, and other plugins may add their own information to this table. || [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Write_-_Make_some_content|Write]]  &gt;&gt; [[Administration_Panels#Write_Post|Write a Post]]
|- valign=top
+
|- valign="top"
| [[#Table:_wp_posts|wp_posts]] || The core of the WordPress data is the '''posts'''. It is stored in the ttwp_posts/tt table.  || [[Administration Panels]]  gt;gt; [[Administration_Panels#Write_-_Make_some_content|Write]]  gt;gt; [[Administration_Panels#Write_Post|Write a Post]]
+
| [[#Table:_wp_posts|wp_posts]] || The core of the WordPress data is the '''posts'''. It is stored in the <tt>wp_posts</tt> table.  || [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Write_-_Make_some_content|Write]]  &gt;&gt; [[Administration_Panels#Write_Post|Write a Post]]
|- valign=top
+
|- valign="top"
| [[#Table:_wp_terms|wp_terms]] || The '''categories''' for both posts and links and the '''tags''' for posts are found within the ttwp_terms/tt  table. || [[Administration Panels]]  gt;gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] gt;gt; [[Administration_Panels#Categories|Categories]]br /[[Administration Panels]] gt;gt; [[Administration_Panels#Write_-_Make_some_content|Write]] gt;gt; [[Administration_Panels#Write_Post|Write Post]]br /  [[Administration Panels]] gt;gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] gt;gt; [[Administration_Panels#Posts|Posts]] gt;gt; [[Administration_Panels#Write_Post|Edit]]
+
| [[#Table:_wp_terms|wp_terms]] || The '''categories''' for both posts and links and the '''tags''' for posts are found within the <tt>wp_terms</tt> table. || [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] &gt;&gt; [[Administration_Panels#Categories|Categories]]<br />[[Administration Panels]] &gt;&gt; [[Administration_Panels#Write_-_Make_some_content|Write]] &gt;&gt; [[Administration_Panels#Write_Post|Write Post]]<br /> [[Administration Panels]] &gt;&gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] &gt;&gt; [[Administration_Panels#Posts|Posts]] &gt;&gt; [[Administration_Panels#Write_Post|Edit]]
|- valign=top
+
|- valign="top"
| [[#Table:_wp_term_relationships|wp_term_relationships]] || '''Posts''' are associated with categories and tags from the ttwp_terms/tt table and this association is maintained in the  ttwp_term_relationships/tt table.  The association of '''links''' to their respective categories are also kept in this table.|| [[Administration Panels]]  gt;gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] gt;gt; [[Administration_Panels#Categories|Categories]]br /[[Administration Panels]] gt;gt; [[Administration_Panels#Write_-_Make_some_content|Write]] gt;gt; [[Administration_Panels#Write_Post|Write Post]]br /  [[Administration Panels]] gt;gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] gt;gt; [[Administration_Panels#Posts|Posts]] gt;gt; [[Administration_Panels#Write_Post|Edit]]
+
| [[#Table:_wp_term_relationships|wp_term_relationships]] || '''Posts''' are associated with categories and tags from the <tt>wp_terms</tt> table and this association is maintained in the  <tt>wp_term_relationships</tt> table.  The association of '''links''' to their respective categories are also kept in this table.|| [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] &gt;&gt; [[Administration_Panels#Categories|Categories]]<br />[[Administration Panels]] &gt;&gt; [[Administration_Panels#Write_-_Make_some_content|Write]] &gt;&gt; [[Administration_Panels#Write_Post|Write Post]]<br /> [[Administration Panels]] &gt;&gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] &gt;&gt; [[Administration_Panels#Posts|Posts]] &gt;&gt; [[Administration_Panels#Write_Post|Edit]]
|- valign=top
+
|- valign="top"
| [[#Table:_wp_term_taxonomy|wp_term_taxonomy]] || This table describes the taxonomy ('''category''', '''link''', or '''tag''') for the entries in the ttwp_terms/tt  table. || [[Administration Panels]]  gt;gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] gt;gt; [[Administration_Panels#Categories|Categories]]br /[[Administration Panels]] gt;gt; [[Administration_Panels#Write_-_Make_some_content|Write]] gt;gt; [[Administration_Panels#Write_Post|Write Post]]br /  [[Administration Panels]] gt;gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] gt;gt; [[Administration_Panels#Posts|Posts]] gt;gt; [[Administration_Panels#Write_Post|Edit]]
+
| [[#Table:_wp_term_taxonomy|wp_term_taxonomy]] || This table describes the taxonomy ('''category''', '''link''', or '''tag''') for the entries in the <tt>wp_terms</tt> table. || [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] &gt;&gt; [[Administration_Panels#Categories|Categories]]<br />[[Administration Panels]] &gt;&gt; [[Administration_Panels#Write_-_Make_some_content|Write]] &gt;&gt; [[Administration_Panels#Write_Post|Write Post]]<br /> [[Administration Panels]] &gt;&gt; [[Administration_Panels#Manage_-_Change_your_content|Manage]] &gt;&gt; [[Administration_Panels#Posts|Posts]] &gt;&gt; [[Administration_Panels#Write_Post|Edit]]
|- valign=top
+
|- valign="top"
| [[#Table:_wp_usermeta|wp_usermeta]] || Each '''user''' features information called the '''meta data''' and it is  stored in ttwp_usermeta/tt. || [[Administration Panels]]  gt;gt; [[Administration_Panels#Users_-_Your_Blogging_Family|Users]]
+
| [[#Table:_wp_usermeta|wp_usermeta]] || Each '''user''' features information called the '''meta data''' and it is  stored in <tt>wp_usermeta</tt>. || [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Users_-_Your_Blogging_Family|Users]]
|- valign=top
+
|- valign="top"
| height=55 | [[#Table:_wp_users|wp_users]] || The list of '''users''' is maintained in table ttwp_users/tt. || [[Administration Panels]]  gt;gt; [[Administration_Panels#Users_-_Your_Blogging_Family|Users]]
+
| height="55" | [[#Table:_wp_users|wp_users]] || The list of '''users''' is maintained in table <tt>wp_users</tt>. || [[Administration Panels]]  &gt;&gt; [[Administration_Panels#Users_-_Your_Blogging_Family|Users]]
|}br /br /
+
|}<br /><br />
  
 
=Table Details=
 
=Table Details=
第39行: 第39行:
  
 
==Table: wp_comments==
 
==Table: wp_comments==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|comment_ID||bigint(20) unsigned||nbsp;||PRI||NULL||auto_increment
+
|comment_ID||bigint(20) unsigned||&nbsp;||PRI||NULL||auto_increment
 
|-
 
|-
|comment_post_ID||int(11)||nbsp;||IND||0||FK-gt;wp_posts.ID
+
|comment_post_ID||int(11)||&nbsp;||IND||0||FK-&gt;wp_posts.ID
 
|-
 
|-
|comment_author||tinytext||nbsp;||nbsp;||nbsp;||nbsp;
+
|comment_author||tinytext||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|comment_author_email||varchar(100)||nbsp;||nbsp;||nbsp;||nbsp;
+
|comment_author_email||varchar(100)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|comment_author_url||varchar(200)||nbsp;||nbsp;||nbsp;||nbsp;
+
|comment_author_url||varchar(200)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|comment_author_IP||varchar(100)||nbsp;||nbsp;||nbsp;||nbsp;
+
|comment_author_IP||varchar(100)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|comment_date||datetime||nbsp;||nbsp;||0000-00-00 00:00:00||nbsp;
+
|comment_date||datetime||&nbsp;||&nbsp;||0000-00-00 00:00:00||&nbsp;
 
|-
 
|-
|comment_date_gmt||datetime||nbsp;||nbsp;||0000-00-00 00:00:00||nbsp;
+
|comment_date_gmt||datetime||&nbsp;||&nbsp;||0000-00-00 00:00:00||&nbsp;
 
|-
 
|-
|comment_content||text||nbsp;||nbsp;||nbsp;||nbsp;
+
|comment_content||text||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|comment_karma||int(11)||nbsp;||nbsp;||0||nbsp;
+
|comment_karma||int(11)||&nbsp;||&nbsp;||0||&nbsp;
 
|-
 
|-
|comment_approved||enum('0','1','spam')||nbsp;||IND||1||nbsp;
+
|comment_approved||enum('0','1','spam')||&nbsp;||IND||1||&nbsp;
 
|-
 
|-
|comment_agent||varchar(255)||nbsp;||nbsp;||nbsp;||nbsp;
+
|comment_agent||varchar(255)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|comment_type||varchar(20)||nbsp;||nbsp;||nbsp;||nbsp;
+
|comment_type||varchar(20)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|comment_parent||bigint(20)||nbsp;||nbsp;||0||FK-gt;wp_comment.ID
+
|comment_parent||bigint(20)||&nbsp;||&nbsp;||0||FK-&gt;wp_comment.ID
 
|-
 
|-
|user_id||bigint(20)||nbsp;||nbsp;||0||FK-gt;wp_users.ID
+
|user_id||bigint(20)||&nbsp;||&nbsp;||0||FK-&gt;wp_users.ID
 
|}
 
|}
  
 
==Table: wp_links==
 
==Table: wp_links==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|link_id||bigint(20)||nbsp;||PRI||NULL||auto_increment
+
|link_id||bigint(20)||&nbsp;||PRI||NULL||auto_increment
 
|-
 
|-
|link_url||varchar(255)||nbsp;||nbsp;||nbsp;||nbsp;
+
|link_url||varchar(255)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|link_name||varchar(255)||nbsp;||nbsp;||nbsp;||nbsp;
+
|link_name||varchar(255)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|link_image||varchar(255)||nbsp;||nbsp;||nbsp;||nbsp;
+
|link_image||varchar(255)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|link_target||varchar(25)||nbsp;||nbsp;||nbsp;||nbsp;
+
|link_target||varchar(25)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|link_category||bigint(20)||nbsp;||IND||0||FK-gt;wp_categories.cat_ID
+
|link_category||bigint(20)||&nbsp;||IND||0||FK-&gt;wp_categories.cat_ID
 
|-
 
|-
|link_description||varchar(255)||nbsp;||nbsp;||nbsp;||nbsp;
+
|link_description||varchar(255)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|link_visible||enum('Y','N')||nbsp;||IND||Y||nbsp;
+
|link_visible||enum('Y','N')||&nbsp;||IND||Y||&nbsp;
 
|-
 
|-
|link_owner||int(11)||nbsp;||nbsp;||1||nbsp;
+
|link_owner||int(11)||&nbsp;||&nbsp;||1||&nbsp;
 
|-
 
|-
|link_rating||int(11)||nbsp;||nbsp;||0||nbsp;
+
|link_rating||int(11)||&nbsp;||&nbsp;||0||&nbsp;
 
|-
 
|-
|link_updated||datetime||nbsp;||nbsp;||0000-00-00 00:00:00||nbsp;
+
|link_updated||datetime||&nbsp;||&nbsp;||0000-00-00 00:00:00||&nbsp;
 
|-
 
|-
|link_rel||varchar(255)||nbsp;||nbsp;||nbsp;||nbsp;
+
|link_rel||varchar(255)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|link_notes||mediumtext||nbsp;||nbsp;||nbsp;||nbsp;
+
|link_notes||mediumtext||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|link_rss||varchar(255)||nbsp;||nbsp;||nbsp;||nbsp;
+
|link_rss||varchar(255)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|}
 
|}
  
  
 
==Table: wp_options==
 
==Table: wp_options==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|option_id||bigint(20)||nbsp;||PRI||NULL||auto_increment
+
|option_id||bigint(20)||&nbsp;||PRI||NULL||auto_increment
 
|-
 
|-
|blog_id||int(11)||nbsp;||PRI||0||nbsp;
+
|blog_id||int(11)||&nbsp;||PRI||0||&nbsp;
 
|-
 
|-
|option_name||varchar(64)||nbsp;||PRIIND||nbsp;||nbsp;
+
|option_name||varchar(64)||&nbsp;||PRI&IND||&nbsp;||&nbsp;
 
|-
 
|-
|option_can_override||enum('Y','N')||nbsp;||nbsp;||Y||nbsp;
+
|option_can_override||enum('Y','N')||&nbsp;||&nbsp;||Y||&nbsp;
 
|-
 
|-
|option_type||int(11)||nbsp;||nbsp;||1||nbsp;
+
|option_type||int(11)||&nbsp;||&nbsp;||1||&nbsp;
 
|-
 
|-
|option_value||longtext||nbsp;||nbsp;||nbsp;||
+
|option_value||longtext||&nbsp;||&nbsp;||&nbsp;||
 
|-
 
|-
|option_width||int(11)||nbsp;||nbsp;||20||nbsp;
+
|option_width||int(11)||&nbsp;||&nbsp;||20||&nbsp;
 
|-
 
|-
|option_height||int(11)||nbsp;||nbsp;||8||nbsp;
+
|option_height||int(11)||&nbsp;||&nbsp;||8||&nbsp;
 
|-
 
|-
|option_description||tinytext||nbsp;||nbsp;||nbsp;||
+
|option_description||tinytext||&nbsp;||&nbsp;||&nbsp;||
 
|-
 
|-
|option_admin_level||int(11)||nbsp;||nbsp;||1||nbsp;
+
|option_admin_level||int(11)||&nbsp;||&nbsp;||1||&nbsp;
 
|-
 
|-
|autoload||enum('yes','no')||nbsp;||nbsp;||yes||nbsp;
+
|autoload||enum('yes','no')||&nbsp;||&nbsp;||yes||&nbsp;
 
|}
 
|}
  
  
 
==Table: wp_postmeta==
 
==Table: wp_postmeta==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|meta_id||bigint(20)||nbsp;||PRI||NULL||auto_increment
+
|meta_id||bigint(20)||&nbsp;||PRI||NULL||auto_increment
 
|-
 
|-
|post_id||bigint(20)||nbsp;||IND||0||FK-gt;wp_posts.ID
+
|post_id||bigint(20)||&nbsp;||IND||0||FK-&gt;wp_posts.ID
 
|-
 
|-
|meta_key||varchar(255)||YES||IND||NULL||nbsp;
+
|meta_key||varchar(255)||YES||IND||NULL||&nbsp;
 
|-
 
|-
|meta_value||longtext||YES||nbsp;||NULL||nbsp;
+
|meta_value||longtext||YES||&nbsp;||NULL||&nbsp;
 
|}
 
|}
  
  
 
==Table: wp_posts==
 
==Table: wp_posts==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|ID||bigint(20) unsigned||nbsp;||PRI||NULL||auto_increment
+
|ID||bigint(20) unsigned||&nbsp;||PRI||NULL||auto_increment
 
|-
 
|-
|post_author||bigint(20)||nbsp;||nbsp;||0||FK-gt;wp_users.ID
+
|post_author||bigint(20)||&nbsp;||&nbsp;||0||FK-&gt;wp_users.ID
 
|-
 
|-
|post_date||datetime||nbsp;||nbsp;||0000-00-00 00:00:00||nbsp;
+
|post_date||datetime||&nbsp;||&nbsp;||0000-00-00 00:00:00||&nbsp;
 
|-
 
|-
|post_date_gmt||datetime||nbsp;||nbsp;||0000-00-00 00:00:00||nbsp;
+
|post_date_gmt||datetime||&nbsp;||&nbsp;||0000-00-00 00:00:00||&nbsp;
 
|-
 
|-
|post_content||longtext||nbsp;||nbsp;||nbsp;||nbsp;
+
|post_content||longtext||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|post_title||text||nbsp;||nbsp;||nbsp;||nbsp;
+
|post_title||text||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|post_category||int(4)||nbsp;||nbsp;||0||FK-gt;wp_categories.cat_ID
+
|post_category||int(4)||&nbsp;||&nbsp;||0||FK-&gt;wp_categories.cat_ID
 
|-
 
|-
|post_excerpt||text||nbsp;||nbsp;||nbsp;||nbsp;
+
|post_excerpt||text||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|post_status||enum('publish','draft','private','static','object','attachment','inherit','future')||nbsp;||IND||publish||nbsp;
+
|post_status||enum('publish','draft','private','static','object','attachment','inherit','future')||&nbsp;||IND||publish||&nbsp;
 
|-
 
|-
|comment_status||enum('open','closed','registered_only')||nbsp;||nbsp;||open||nbsp;
+
|comment_status||enum('open','closed','registered_only')||&nbsp;||&nbsp;||open||&nbsp;
 
|-
 
|-
|ping_status||enum('open','closed')||nbsp;||nbsp;||open||nbsp;
+
|ping_status||enum('open','closed')||&nbsp;||&nbsp;||open||&nbsp;
 
|-
 
|-
|post_password||varchar(20)||nbsp;||nbsp;||nbsp;||nbsp;
+
|post_password||varchar(20)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|post_name||varchar(200)||nbsp;||IND||nbsp;||nbsp;
+
|post_name||varchar(200)||&nbsp;||IND||&nbsp;||&nbsp;
 
|-
 
|-
|to_ping||text||nbsp;||nbsp;||nbsp;||nbsp;
+
|to_ping||text||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|pinged||text||nbsp;||nbsp;||nbsp;||nbsp;
+
|pinged||text||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|post_modified||datetime||nbsp;||nbsp;||0000-00-00 00:00:00||nbsp;
+
|post_modified||datetime||&nbsp;||&nbsp;||0000-00-00 00:00:00||&nbsp;
 
|-
 
|-
|post_modified_gmt||datetime||nbsp;||nbsp;||0000-00-00 00:00:00||nbsp;
+
|post_modified_gmt||datetime||&nbsp;||&nbsp;||0000-00-00 00:00:00||&nbsp;
 
|-
 
|-
|post_content_filtered||text||nbsp;||nbsp;||nbsp;||
+
|post_content_filtered||text||&nbsp;||&nbsp;||&nbsp;||
 
|-
 
|-
|post_parent||bigint(20)||nbsp;||nbsp;||0||FK-gt;wp_posts.ID
+
|post_parent||bigint(20)||&nbsp;||&nbsp;||0||FK-&gt;wp_posts.ID
 
|-
 
|-
|guid||varchar(255)||nbsp;||nbsp;||nbsp;||nbsp;
+
|guid||varchar(255)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|menu_order||int(11)||nbsp;||nbsp;||0||nbsp;
+
|menu_order||int(11)||&nbsp;||&nbsp;||0||&nbsp;
 
|-
 
|-
|post_type||varchar(20)||nbsp;||nbsp;||post||nbsp;
+
|post_type||varchar(20)||&nbsp;||&nbsp;||post||&nbsp;
 
|-
 
|-
|post_mime_type||varchar(100)||nbsp;||nbsp;||nbsp;||nbsp;
+
|post_mime_type||varchar(100)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|comment_count||bigint(20)||nbsp;||nbsp;||0||nbsp;
+
|comment_count||bigint(20)||&nbsp;||&nbsp;||0||&nbsp;
 
|}
 
|}
  
 
==Table: wp_terms==
 
==Table: wp_terms==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|term_id||bigint(20)||nbsp;||PRI||nbsp;||auto_increment
+
|term_id||bigint(20)||&nbsp;||PRI||&nbsp;||auto_increment
 
|-
 
|-
|name||varchar(55)||nbsp;||nbsp;||nbsp; ||nbsp;
+
|name||varchar(55)||&nbsp;||&nbsp;||&nbsp; ||&nbsp;
 
|-
 
|-
|slug||varchar(200)||nbsp;||UNI IND||nbsp;||nbsp;
+
|slug||varchar(200)||&nbsp;||UNI IND||&nbsp;||&nbsp;
 
|-
 
|-
|term_group||bigint(10)||nbsp;||nbsp;||0||nbsp;
+
|term_group||bigint(10)||&nbsp;||&nbsp;||0||&nbsp;
 
|}
 
|}
  
 
==Table: wp_term_relationships==
 
==Table: wp_term_relationships==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|object_id||bigint(20)||nbsp;||PRI Pt1||0||nbsp;
+
|object_id||bigint(20)||&nbsp;||PRI Pt1||0||&nbsp;
 
|-
 
|-
|term_taxonomy_id||bigint(20)||nbsp;||PRI Pt2, IND||0||FK-gt;wp_term_taxonomy.term_taxonomy_id
+
|term_taxonomy_id||bigint(20)||&nbsp;||PRI Pt2, IND||0||FK-&gt;wp_term_taxonomy.term_taxonomy_id
 
|}
 
|}
  
 
==Table: wp_term_taxonomy==
 
==Table: wp_term_taxonomy==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|term_taxonomy_id||bigint(20)||nbsp;||PRI||nbsp;||auto_increment
+
|term_taxonomy_id||bigint(20)||&nbsp;||PRI||&nbsp;||auto_increment
 
|-
 
|-
|term_id||bigint(20)||nbsp;||UNI IND Pt1||0 ||FK-gt;wp_terms.term_id
+
|term_id||bigint(20)||&nbsp;||UNI IND Pt1||0 ||FK-&gt;wp_terms.term_id
 
|-
 
|-
|taxonomy||varchar(32)||nbsp;||UNI IND Pt2||nbsp;||nbsp;
+
|taxonomy||varchar(32)||&nbsp;||UNI IND Pt2||&nbsp;||&nbsp;
 
|-
 
|-
|description||longtext||nbsp;||nbsp;||nbsp;||nbsp;
+
|description||longtext||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|parent||bigint(20)||nbsp;||nbsp;||0||nbsp;
+
|parent||bigint(20)||&nbsp;||&nbsp;||0||&nbsp;
 
|-
 
|-
|count||bigint(20)||nbsp;||nbsp;||0||nbsp;
+
|count||bigint(20)||&nbsp;||&nbsp;||0||&nbsp;
 
|-
 
|-
 
|}
 
|}
  
 
==Table: wp_usermeta==
 
==Table: wp_usermeta==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|umeta_id||bigint(20)||nbsp;||PRI||NULL||auto_increment
+
|umeta_id||bigint(20)||&nbsp;||PRI||NULL||auto_increment
 
|-
 
|-
|user_id||bigint(20)||nbsp;||nbsp;||'0'||FK-gt;wp_users.ID
+
|user_id||bigint(20)||&nbsp;||&nbsp;||'0'||FK-&gt;wp_users.ID
 
|-
 
|-
|meta_key||varchar(255)||nbsp;||IND||NULL||nbsp;
+
|meta_key||varchar(255)||&nbsp;||IND||NULL||&nbsp;
 
|-
 
|-
|meta_value||longtext||nbsp;||IND||NULL||nbsp;
+
|meta_value||longtext||&nbsp;||IND||NULL||&nbsp;
 
|}
 
|}
  
  
 
==Table: wp_users==
 
==Table: wp_users==
{| table width=90% border=1
+
{| table width="90%" border=1
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
!Field!!Type!!Null!!Key!!Default!!Extra
 
|-
 
|-
|ID||bigint(20) unsigned||nbsp;||PRI||NULL||auto_increment
+
|ID||bigint(20) unsigned||&nbsp;||PRI||NULL||auto_increment
 
|-
 
|-
|user_login||varchar(60)||nbsp;||UNI IND||nbsp;||nbsp;
+
|user_login||varchar(60)||&nbsp;||UNI & IND||&nbsp;||&nbsp;
 
|-
 
|-
|user_pass||varchar(64)||nbsp;||nbsp;||nbsp;||nbsp;
+
|user_pass||varchar(64)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|user_nicename||varchar(50)||nbsp;||nbsp;||nbsp;||nbsp;
+
|user_nicename||varchar(50)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|user_email||varchar(100)||nbsp;||nbsp;||nbsp;||nbsp;
+
|user_email||varchar(100)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|user_url||varchar(100)||nbsp;||nbsp;||nbsp;||nbsp;
+
|user_url||varchar(100)||&nbsp;||&nbsp;||&nbsp;||&nbsp;
 
|-
 
|-
|user_registered||datetime||nbsp;||nbsp;||0000-00-00 00:00:00||nbsp;
+
|user_registered||datetime||&nbsp;||&nbsp;||0000-00-00 00:00:00||&nbsp;
 
|-
 
|-
|user_level||int(2) unsigned||nbsp;||nbsp;||0||nbsp;
+
|user_level||int(2) unsigned||&nbsp;||&nbsp;||0||&nbsp;
 
|-
 
|-
|user_activation_key||varchar(60)||nbsp;||nbsp;||nbsp;||
+
|user_activation_key||varchar(60)||&nbsp;||&nbsp;||&nbsp;||
 
|-
 
|-
|user_status||int(11)||nbsp;||nbsp;||0||nbsp;
+
|user_status||int(11)||&nbsp;||&nbsp;||0||&nbsp;
 
|-
 
|-
|display_name||varchar(250)||nbsp;||nbsp;||nbsp; ||nbsp;
+
|display_name||varchar(250)||&nbsp;||&nbsp;||&nbsp; ||&nbsp;
 
|}
 
|}
  

2011年5月20日 (五) 00:19的版本

includeonlydiv style=clear:both; background-color:#FFFFFF; border:1px solid #FFFFFF; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;span style=float:left; margin:4px/spanThis article, written to accord with WordPress 2.3, is now obsolete. Please take caution when following its contents, as many things may have changed./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude

The following is an outline and description of the database tables created during the standard installation of WordPress at Version 2.3.

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 Overview

This section is the overview of all the tables created during the WordPress standard installation. It is followed by specific information of what is in each table.

WordPress 2.3 Tables (10)
Table Name Description Relevant Area(s) of WordPress User Interface
wp_comments The comments within WordPress are stored in the wp_comments table. Comments are created by readers as responses to posts. Comments are managed by administrator via Administration Panels >> Manage >> Comments
wp_links The wp_links holds information related to the links entered into the Blogroll Manager feature of WordPress. Administration Panels >> Blogroll >> Manage Blogroll
Administration Panels >> Blogroll >> Add Links
Administration Panels >> Blogroll >> Import Links
wp_options The Options set under the Administration > Options panel are stored in the wp_options table. 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_postmeta Each post features information called the meta data and it is stored in the wp_postmeta. Some tag plugins, and other plugins may add their own information to this table. Administration Panels >> Write >> Write a Post
wp_posts The core of the WordPress data is the posts. It is stored in the wp_posts table. Administration Panels >> Write >> Write a Post
wp_terms The categories for both posts and links and the tags for posts are found within the wp_terms table. Administration Panels >> Manage >> Categories
Administration Panels >> Write >> Write Post
Administration Panels >> Manage >> Posts >> Edit
wp_term_relationships Posts are associated with categories and tags from the wp_terms table and this association is maintained in the wp_term_relationships table. The association of links to their respective categories are also kept in this table. Administration Panels >> Manage >> Categories
Administration Panels >> Write >> Write Post
Administration Panels >> Manage >> Posts >> Edit
wp_term_taxonomy This table describes the taxonomy (category, link, or tag) for the entries in the wp_terms table. Administration Panels >> Manage >> Categories
Administration Panels >> Write >> Write Post
Administration Panels >> Manage >> Posts >> Edit
wp_usermeta Each user features information called the meta data and it is stored in wp_usermeta. Administration Panels >> Users
wp_users The list of users is maintained in table wp_users. Administration Panels >> Users


Table Details

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

Table: wp_comments

Field Type Null Key Default Extra
comment_ID bigint(20) unsigned   PRI NULL auto_increment
comment_post_ID int(11)   IND 0 FK->wp_posts.ID
comment_author tinytext        
comment_author_email varchar(100)        
comment_author_url varchar(200)        
comment_author_IP varchar(100)        
comment_date datetime     0000-00-00 00:00:00  
comment_date_gmt datetime     0000-00-00 00:00:00  
comment_content text        
comment_karma int(11)     0  
comment_approved enum('0','1','spam')   IND 1  
comment_agent varchar(255)        
comment_type varchar(20)        
comment_parent bigint(20)     0 FK->wp_comment.ID
user_id bigint(20)     0 FK->wp_users.ID

Table: wp_links

Field Type Null Key Default Extra
link_id bigint(20)   PRI NULL auto_increment
link_url varchar(255)        
link_name varchar(255)        
link_image varchar(255)        
link_target varchar(25)        
link_category bigint(20)   IND 0 FK->wp_categories.cat_ID
link_description varchar(255)        
link_visible enum('Y','N')   IND Y  
link_owner int(11)     1  
link_rating int(11)     0  
link_updated datetime     0000-00-00 00:00:00  
link_rel varchar(255)        
link_notes mediumtext        
link_rss varchar(255)        


Table: wp_options

Field Type Null Key Default Extra
option_id bigint(20)   PRI NULL auto_increment
blog_id int(11)   PRI 0  
option_name varchar(64)   PRI&IND    
option_can_override enum('Y','N')     Y  
option_type int(11)     1  
option_value longtext      
option_width int(11)     20  
option_height int(11)     8  
option_description tinytext      
option_admin_level int(11)     1  
autoload enum('yes','no')     yes  


Table: wp_postmeta

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


Table: wp_posts

Field Type Null Key Default Extra
ID bigint(20) unsigned   PRI NULL auto_increment
post_author bigint(20)     0 FK->wp_users.ID
post_date datetime     0000-00-00 00:00:00  
post_date_gmt datetime     0000-00-00 00:00:00  
post_content longtext        
post_title text        
post_category int(4)     0 FK->wp_categories.cat_ID
post_excerpt text        
post_status enum('publish','draft','private','static','object','attachment','inherit','future')   IND publish  
comment_status enum('open','closed','registered_only')     open  
ping_status enum('open','closed')     open  
post_password varchar(20)        
post_name varchar(200)   IND    
to_ping text        
pinged text        
post_modified datetime     0000-00-00 00:00:00  
post_modified_gmt datetime     0000-00-00 00:00:00  
post_content_filtered text      
post_parent bigint(20)     0 FK->wp_posts.ID
guid varchar(255)        
menu_order int(11)     0  
post_type varchar(20)     post  
post_mime_type varchar(100)        
comment_count bigint(20)     0  

Table: wp_terms

Field Type Null Key Default Extra
term_id bigint(20)   PRI   auto_increment
name varchar(55)        
slug varchar(200)   UNI IND    
term_group bigint(10)     0  

Table: wp_term_relationships

Field Type Null Key Default Extra
object_id bigint(20)   PRI Pt1 0  
term_taxonomy_id bigint(20)   PRI Pt2, IND 0 FK->wp_term_taxonomy.term_taxonomy_id

Table: wp_term_taxonomy

Field Type Null Key Default Extra
term_taxonomy_id bigint(20)   PRI   auto_increment
term_id bigint(20)   UNI IND Pt1 0 FK->wp_terms.term_id
taxonomy varchar(32)   UNI IND Pt2    
description longtext        
parent bigint(20)     0  
count bigint(20)     0  

Table: wp_usermeta

Field Type Null Key Default Extra
umeta_id bigint(20)   PRI NULL auto_increment
user_id bigint(20)     '0' FK->wp_users.ID
meta_key varchar(255)   IND NULL  
meta_value longtext   IND NULL  


Table: wp_users

Field Type Null Key Default Extra
ID bigint(20) unsigned   PRI NULL auto_increment
user_login varchar(60)   UNI & IND    
user_pass varchar(64)        
user_nicename varchar(50)        
user_email varchar(100)        
user_url varchar(100)        
user_registered datetime     0000-00-00 00:00:00  
user_level int(2) unsigned     0  
user_activation_key varchar(60)      
user_status int(11)     0  
display_name varchar(250)        

Resources