WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Database Description/1.5

wp-alert.png
This article, written to accord with WordPress 1.5, is now obsolete. Please take caution when following its contents, as many things may have changed.

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

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 1.5 Tables (9)
Table Name Description Relevant Area(s) of WordPress User Interface
wp_categories The post categories for WordPress are found within the wp_categories table and they feature five columns. Refer to Administration Panels >> Manage >> Categories
wp_comments The comments within WordPress are stored in the wp_comments table which contains 15 columns. Comments are created by readers as responses to posts. Comments are managed by administrator via 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_users The list of users is maintained in table.wp_users, which has 22 columns. Administration Panels >> Users


Table Details

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

Table: wp_categories

Field Type Null Key Default Extra
cat_ID bigint(20)   PRI NULL auto_increment
cat_name varchar(55)        
category_nicename varchar(200)   MUL    
category_description longtext        
category_parent int(4)     0  


Table: wp_comments

Field Type Null Key Default Extra
comment_ID bigint(20) unsigned   PRI NULL auto_increment
comment_post_ID int(11)   MUL 0  
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')   MUL 1  
comment_agent varchar(255)        
comment_type varchar(20)        
comment_parent int(11)     0  
user_id int(11)     0  


Table: wp_linkcategories

Field Type Null Key Default Extra
cat_id bigint(20)   PRI NULL auto_increment
cat_name tinytext        
auto_toggle enum('Y','N')     N  
show_images enum('Y','N')     Y  
show_description enum('Y','N')     N  
show_rating enum('Y','N')     Y  
show_updated enum('Y','N')     Y  
sort_order varchar(64)     rand  
sort_desc enum('Y','N')     N  
text_before_link varchar(128)     <li>  
text_after_link varchar(128)     <br />  
text_after_all varchar(128)     </li>  
list_limit int(11)     -1  


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 int(11)   MUL 0  
link_description varchar(255)        
link_visible enum('Y','N')   MUL 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    
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_post2cat

Field Type Null Key Default Extra
rel_id bigint(20)   PRI NULL auto_increment
post_id bigint(20)   MUL 0  
category_id bigint(20)     0  


Table: wp_postmeta

Field Type Null Key Default Extra
meta_id bigint(20)   PRI NULL auto_increment
post_id bigint(20)   MUL 0  
meta_key varchar(255) YES MUL NULL  
meta_value text YES   NULL  


Table: wp_posts

Field Type Null Key Default Extra
ID bigint(20) unsigned   PRI NULL auto_increment
post_author int(4)     0  
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  
post_excerpt text        
post_status enum('publish','draft','private','static','object')   MUL publish  
comment_status enum('open','closed','registered_only')     open  
ping_status enum('open','closed')     open  
post_password varchar(20)        
post_name varchar(200)   MUL    
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 int(11)     0  
guid varchar(255)        
menu_order int(11)     0  


Table: wp_users

Field Type Null Key Default Extra
ID bigint(20) unsigned   PRI NULL auto_increment
user_login varchar(60)   UNI    
user_pass varchar(64)        
user_firstname varchar(50)        
user_lastname varchar(50)        
user_nickname varchar(50)        
user_nicename varchar(50)        
user_icq int(10) unsigned     0  
user_email varchar(100)        
user_url varchar(100)        
user_ip varchar(15)        
user_domain varchar(200)        
user_browser varchar(200)        
user_registered datetime     0000-00-00 00:00:00  
user_level int(2) unsigned     0  
user_aim varchar(50)        
user_msn varchar(100)        
user_yim varchar(50)        
user_idmode varchar(20)        
user_activation_key varchar(60)      
user_status int(11)     0  
user_description longtext