Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Updated Saturday, August 30th, 2008 at 5:17pm

WordPress 2.3+ Database Structure for Categories

With the release of WordPress 2.3, there were several major changes to the database structure. Most notably was the new taxonomy schema, which replaced the categories, post2cat, and link2cat tables in favor of a new term based system with three new tables – terms, term_taxonomy, and term_relationships. While there are plenty of guides on the new structure, this is a simple visual guide to the relationships of these tables – specifically for category handling. This information is really only useful for those who are writing plugins or other code that interface with the database directly, and want a handy reminder of the table relationships.

Notes

The descriptions of the table fields in the reference image below just apply to categories. The taxonomy schema is also used to handle several other objects.

When writing queries to link the tables together, be sure to use the following statement so that the results are limited to category objects:

(table_prefix)_term_taxonomy.taxnomy = 'category'

WordPress 2.3+ Database Structure for Categories

Just right-click to save the image.

  If you have found this page useful, please consider donating. Thanks!