[wp-hackers] term_taxonomy_id = term_id. Always?

Haluk Karamete halukkaramete at gmail.com
Mon Apr 9 01:53:18 UTC 2012

I've been trying to understand the how the tables are related by adding new
tags, cats, sub cats to a fresh install and examine what's happening behind
the scenes through phpmyadmin.

I've observed that for the early records... the two id's in the
wp_term_taxonomy  ( which are term_taxonomy_id & term_id ) always go hand
in hand. Whatever the value is for one is the value for the other. When
does these guys break apart?

That's my first question.

So far, I've observed the following rules

Unless you add a new term ( that is adding a new category or tag or add new
link into the system ), the following two tables won't get changed.


Another way to say the above sentence,


gets changed only when you add a new term.

As you associate tags/categories with posts, and links with
link_categories, you cause a change in the following table


there are two important fields in this table, the object_id and
I dunno what the heck term_order is used for here - yet.
 When I see the object_id "1" in there, I mistakingly thought that the
object_id values stored in that table refer to the ID field values of the
wp_posts.  No. It could be either "id=1 of wp_posts" or the "link_id=1 of
 Also, in the wp_term_relationships table, I see some other records which
happen to be related to the term_taxonomy_id 2.
 I thought that that "2" here refers to the term_taxonomy_id=2 of the
"wp_term_taxonomy" table which in turn means the taxonomy  "link_category".
But up until now, I'm not sure if that "2" is the term_id of the wp_terms
which in turn means the term "blogroll".

Please clarify.

More information about the wp-hackers mailing list