Codex

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

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

Field Type Null Key Default Extra
term_id bigint(20)   PRI NULL auto_increment
term_name varchar(55)        
term_slug varchar(200)   UNQ    
term_group bigint(20)     0  
category_count bigint(20)     0  

Table: wp_term_taxonomy

Field Type Null Key Default Extra
term_taxonomy_id bigint(20)   PRI NULL auto_increment
term_id bigint(20)   IND NULL  
taxonomy varchar(20)        
term_description longtext        
parent bigint(20)     0  
count bigint(20)     0  

Table: wp_term_relationships

Field Type Null Key Default Extra
object_id bigint(20)   PRI NULL  
term_taxonomy_id bigint(20)   IND NULL