WordPress.org

Codex

User:MichaelH/Terms Tables

This article is a ROUGH DRAFT. The author is still working on this document, so please do not edit this without the author's permission. The content within this article may not yet be verified or valid. This information is subject to change.

Preliminary terms tables that is scheduled for inclusion in 2.3.


CREATE TABLE $wpdb->terms (
 term_id bigint(20) NOT NULL auto_increment,
 term_name varchar(55) NOT NULL default '',
 term_slug varchar(200) NOT NULL default '',
 term_group bigint(10) NOT NULL default 0
 PRIMARY KEY  (term_ID),
 UNIQUE KEY term_slug (term_slug)
);

CREATE TABLE $wpdb->term_taxonomy (
 term_taxonomy_id bigint(20) NOT NULL auto_increment,
 term_id bigint(20) NOT NULL default 0,
 taxonomy varchar(20) NOT NULL default 0,
 term_description longtext NOT NULL,
 parent bigint(20) NOT NULL default 0,
 count bigint(20) NOT NULL default 0,
 PRIMARY KEY (term_taxonomy_id),
 KEY (term_idtaxonomy)
);

CREATE TABLE $wpdb->term_relationships (
 object_id bigint(20) NOT NULL default 0,
 term_taxonomy_id bigint(20) NOT NULL default 0,
 PRIMARY KEY  (object_ID),
 KEY (term_taxonomy_id)
);

Table: wp_terms

FieldTypeNullKeyDefaultExtra
term_idbigint(20) PRINULLauto_increment
term_namevarchar(55)     
term_slugvarchar(200) UNQ  
term_groupbigint(20)  0 
category_countbigint(20)  0 

Table: wp_term_taxonomy

FieldTypeNullKeyDefaultExtra
term_taxonomy_idbigint(20) PRINULLauto_increment
term_idbigint(20) INDNULL 
taxonomyvarchar(20)     
term_descriptionlongtext    
parentbigint(20)  0 
countbigint(20)  0 

Table: wp_term_relationships

FieldTypeNullKeyDefaultExtra
object_idbigint(20) PRINULL 
term_taxonomy_idbigint(20) INDNULL