In the WordPress database table
wp_term_taxonomy, each row almost always has the same value for the two columns
term_id. What is the difference between these two columns?
taxonomyA way to group posts in WordPress (e.g. ‘Categories’ or ‘Tags’ ) See WordPress Taxonomies
termOne of the groups in a taxonomy (e.g. each of the following might be a term associated with a blog post: ‘Funny’, ‘Political’, ‘Satire’)
History of Shared Terms
For a long time if you used the same term name in two different taxonomies, WordPress created only one instance of the term. This was called a shared term and ultimately it cause a bunch of problems (See WordPress core ticket 5809).
For example if your blog had both a category and a tag called
Funny and you decided to change the tag to
Laugh, you would expect to have:
However, since the term was shared across taxonomies changing the tag to “Laugh” would also change the category:
We can see how a term was shared by looking at the database. Even though “Funny” appears in two different taxonomies, it only appears once in the wp_terms database table.
When a term was shared the same
term_id would appear more than once in the wp_term_taxonomy table.
In WordPress 4.2 taxonomy term splitting was performed, taking any term that appeared in multiple taxonomies and making a separate copy of it in wp_terms. (Note: “Funny” now appears twice, as term_id 1 and 4)
No one can know what decisions will be made about the taxonomies in WordPress in the future but this discussion from 2015, Potential roadmap for taxonomy meta and post relationships, proposes the idea of adding the term
slug to the wp_term_taxonomy table and removing the wp_terms table entirely.