Why WordPress uses 4 tables to manage terms





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















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.










share|improve this question









New contributor




harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    1















    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.










    share|improve this question









    New contributor




    harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      1












      1








      1








      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.










      share|improve this question









      New contributor




      harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      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






      share|improve this question









      New contributor




      harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 2 hours ago









      Krzysiek Dróżdż

      18.8k73350




      18.8k73350






      New contributor




      harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 hours ago









      harshit mishraharshit mishra

      91




      91




      New contributor




      harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      harshit mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          2














          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.






          share|improve this answer
























            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.










            draft saved

            draft discarded


















            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









            2














            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.






            share|improve this answer




























              2














              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.






              share|improve this answer


























                2












                2








                2







                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 hours ago









                Krzysiek DróżdżKrzysiek Dróżdż

                18.8k73350




                18.8k73350






















                    harshit mishra is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Statuo de Libereco

                    Tanganjiko

                    Liste der Baudenkmäler in Enneberg