[wp-hackers] term_taxonomy_id = term_id. Always?

Charles Frees-Melvin charles.freesmelvin at me.com
Mon Apr 9 05:28:14 UTC 2012


Basically the term is the basic item and let's call the term Foo (term 1)

Term Taxonomy ID defines the taxonomy or taxonomies that foo is associated with. Then term taxonomy ID could be 1 for foo the category, 2 for foo the tag, 3 for foo the link category. In all these cases there is only one term still foo.

Then in term relationship it associates the term taxonomy is to an item. Because Tags and Categories are associated with a post Post type then the number becomes obviously the post ID. For link categories the link ID, or in theory it could be used to relate to anything that has a number ID. (User ID or some ID from your own table of data.) Term Order is used for special custom sorting situations.

--
Charles E. Frees-Melvin

Sent from my iPhone 4S on Bell

On 2012-04-08, at 22:53, Haluk Karamete <halukkaramete at gmail.com> wrote:

> 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.
> 
> wp_terms
> wp_tem_taxonomy
> 
> Another way to say the above sentence,
> 
> wp_terms
> wp_tem_taxonomy
> 
> 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
> 
> wp_term_relationships
> 
> there are two important fields in this table, the object_id and
> term_taxonomy_id,
> 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
> wp_links".
> 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.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list