Why WordPress uses 4 tables to manage terms
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am a PHP developer and recently I am trying to build a platform which needs lots of categories/filters/tags some in hierarchy some not.
So the question is...
I am able to manage terms in these tables
terms
, terms_metadata
and terms_relationships
, but there is another table in WordPress - terms_taxanomymy
.
What is the significance of defining another table for just storing "parent", "type", "count" and "description" when you can do that in terms
table itself.
php database
New contributor
add a comment |
I am a PHP developer and recently I am trying to build a platform which needs lots of categories/filters/tags some in hierarchy some not.
So the question is...
I am able to manage terms in these tables
terms
, terms_metadata
and terms_relationships
, but there is another table in WordPress - terms_taxanomymy
.
What is the significance of defining another table for just storing "parent", "type", "count" and "description" when you can do that in terms
table itself.
php database
New contributor
add a comment |
I am a PHP developer and recently I am trying to build a platform which needs lots of categories/filters/tags some in hierarchy some not.
So the question is...
I am able to manage terms in these tables
terms
, terms_metadata
and terms_relationships
, but there is another table in WordPress - terms_taxanomymy
.
What is the significance of defining another table for just storing "parent", "type", "count" and "description" when you can do that in terms
table itself.
php database
New contributor
I am a PHP developer and recently I am trying to build a platform which needs lots of categories/filters/tags some in hierarchy some not.
So the question is...
I am able to manage terms in these tables
terms
, terms_metadata
and terms_relationships
, but there is another table in WordPress - terms_taxanomymy
.
What is the significance of defining another table for just storing "parent", "type", "count" and "description" when you can do that in terms
table itself.
php database
php database
New contributor
New contributor
edited 2 hours ago
Krzysiek Dróżdż♦
18.8k73350
18.8k73350
New contributor
asked 2 hours ago
harshit mishraharshit mishra
91
91
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Well, it uses 3 tables. The fourth one (wp_termmeta
) is just a way of allowing you to store some meta values for terms (icons, additional descriptions and so on).
Citing from Codex:
wp_terms - The categories for both posts and links and the tags for posts are found within the wp_terms table.
wp_termmeta - Each term features information called the meta data and it is stored in wp_termmeta.
wp_term_relationships - Posts are associated with categories and tags from the wp_terms table and this association is maintained in
the wp_term_relationships table. The association of links to their
respective categories are also kept in this table.
wp_term_taxonomy - This table describes the taxonomy (category, link, or tag) for the entries in the wp_terms table.
So the only part that may be confusing is that there are separate tables for terms and term_taxonomy... And it can be confusing, because it has lost its meaning nowadays.
But before WP 4.2.2 (I guess) the approach to terms was a little bit different - terms were unique across wp_terms
table.
So if you had “books” as category and “books” as tag, then there was only one record with “books” in wp_terms
and obviously 2 records in wp_term_taxonomy
.
But when the wp_termmeta
table was introduced it would make it confusing - so such terms were split. And today, for the example above, you’ll have two separate rows in wp_terms
table.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "110"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
harshit mishra is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f336243%2fwhy-wordpress-uses-4-tables-to-manage-terms%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Well, it uses 3 tables. The fourth one (wp_termmeta
) is just a way of allowing you to store some meta values for terms (icons, additional descriptions and so on).
Citing from Codex:
wp_terms - The categories for both posts and links and the tags for posts are found within the wp_terms table.
wp_termmeta - Each term features information called the meta data and it is stored in wp_termmeta.
wp_term_relationships - Posts are associated with categories and tags from the wp_terms table and this association is maintained in
the wp_term_relationships table. The association of links to their
respective categories are also kept in this table.
wp_term_taxonomy - This table describes the taxonomy (category, link, or tag) for the entries in the wp_terms table.
So the only part that may be confusing is that there are separate tables for terms and term_taxonomy... And it can be confusing, because it has lost its meaning nowadays.
But before WP 4.2.2 (I guess) the approach to terms was a little bit different - terms were unique across wp_terms
table.
So if you had “books” as category and “books” as tag, then there was only one record with “books” in wp_terms
and obviously 2 records in wp_term_taxonomy
.
But when the wp_termmeta
table was introduced it would make it confusing - so such terms were split. And today, for the example above, you’ll have two separate rows in wp_terms
table.
add a comment |
Well, it uses 3 tables. The fourth one (wp_termmeta
) is just a way of allowing you to store some meta values for terms (icons, additional descriptions and so on).
Citing from Codex:
wp_terms - The categories for both posts and links and the tags for posts are found within the wp_terms table.
wp_termmeta - Each term features information called the meta data and it is stored in wp_termmeta.
wp_term_relationships - Posts are associated with categories and tags from the wp_terms table and this association is maintained in
the wp_term_relationships table. The association of links to their
respective categories are also kept in this table.
wp_term_taxonomy - This table describes the taxonomy (category, link, or tag) for the entries in the wp_terms table.
So the only part that may be confusing is that there are separate tables for terms and term_taxonomy... And it can be confusing, because it has lost its meaning nowadays.
But before WP 4.2.2 (I guess) the approach to terms was a little bit different - terms were unique across wp_terms
table.
So if you had “books” as category and “books” as tag, then there was only one record with “books” in wp_terms
and obviously 2 records in wp_term_taxonomy
.
But when the wp_termmeta
table was introduced it would make it confusing - so such terms were split. And today, for the example above, you’ll have two separate rows in wp_terms
table.
add a comment |
Well, it uses 3 tables. The fourth one (wp_termmeta
) is just a way of allowing you to store some meta values for terms (icons, additional descriptions and so on).
Citing from Codex:
wp_terms - The categories for both posts and links and the tags for posts are found within the wp_terms table.
wp_termmeta - Each term features information called the meta data and it is stored in wp_termmeta.
wp_term_relationships - Posts are associated with categories and tags from the wp_terms table and this association is maintained in
the wp_term_relationships table. The association of links to their
respective categories are also kept in this table.
wp_term_taxonomy - This table describes the taxonomy (category, link, or tag) for the entries in the wp_terms table.
So the only part that may be confusing is that there are separate tables for terms and term_taxonomy... And it can be confusing, because it has lost its meaning nowadays.
But before WP 4.2.2 (I guess) the approach to terms was a little bit different - terms were unique across wp_terms
table.
So if you had “books” as category and “books” as tag, then there was only one record with “books” in wp_terms
and obviously 2 records in wp_term_taxonomy
.
But when the wp_termmeta
table was introduced it would make it confusing - so such terms were split. And today, for the example above, you’ll have two separate rows in wp_terms
table.
Well, it uses 3 tables. The fourth one (wp_termmeta
) is just a way of allowing you to store some meta values for terms (icons, additional descriptions and so on).
Citing from Codex:
wp_terms - The categories for both posts and links and the tags for posts are found within the wp_terms table.
wp_termmeta - Each term features information called the meta data and it is stored in wp_termmeta.
wp_term_relationships - Posts are associated with categories and tags from the wp_terms table and this association is maintained in
the wp_term_relationships table. The association of links to their
respective categories are also kept in this table.
wp_term_taxonomy - This table describes the taxonomy (category, link, or tag) for the entries in the wp_terms table.
So the only part that may be confusing is that there are separate tables for terms and term_taxonomy... And it can be confusing, because it has lost its meaning nowadays.
But before WP 4.2.2 (I guess) the approach to terms was a little bit different - terms were unique across wp_terms
table.
So if you had “books” as category and “books” as tag, then there was only one record with “books” in wp_terms
and obviously 2 records in wp_term_taxonomy
.
But when the wp_termmeta
table was introduced it would make it confusing - so such terms were split. And today, for the example above, you’ll have two separate rows in wp_terms
table.
answered 2 hours ago
Krzysiek Dróżdż♦Krzysiek Dróżdż
18.8k73350
18.8k73350
add a comment |
add a comment |
harshit mishra is a new contributor. Be nice, and check out our Code of Conduct.
harshit mishra is a new contributor. Be nice, and check out our Code of Conduct.
harshit mishra is a new contributor. Be nice, and check out our Code of Conduct.
harshit mishra is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to WordPress Development Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f336243%2fwhy-wordpress-uses-4-tables-to-manage-terms%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown