admin管理员组文章数量:1287818
I can't find the answer for this question on either Wordpress or here, nor via Google searches, so I'm throwing this out to the community.
If you have two taxonomies, and you add 1 term to each taxonomy, will the first term added in taxonomy_1 have a term ID of 1 and the second term added to taxonomy_2 have a term ID of 2?
I can't find the answer for this question on either Wordpress or here, nor via Google searches, so I'm throwing this out to the community.
If you have two taxonomies, and you add 1 term to each taxonomy, will the first term added in taxonomy_1 have a term ID of 1 and the second term added to taxonomy_2 have a term ID of 2?
Share Improve this question asked Jun 4, 2014 at 6:29 AshkasAshkas 1771 gold badge2 silver badges8 bronze badges2 Answers
Reset to default 2The short answer is no. If you have a look at terms, taxonomies and categories, all of them is stores in the database in the wp_terms
table.
Every one of these are assigned a numerical value that is unique to that term/category/taxonomy. This don't just apply to "objects" added to wp_terms
, but to anything added to a specific table in the db. So nothing added to a specific table will ever have the same ID
These ID's are assigned according to the "object's" place in the specific table, in numerical order. So if the last item in that specific table is number 16, the next item that is added will be number 17, hence ID 17 will be assigned to that "object". The next "object" added will then automatically be ID 18 and so forth
So, to conclude, ID's are assigned to their place in a table, and not according to their relation to another "object"
In recent versions of WP you are going to have unique term IDs. Evidence of this is the fact that the methods get_terms and get_term don't require you to pass a taxonomy name. If terms Ids were not unique across taxonomies then passing a taxonomy name would be necessary.
As a side note, there used to be the concept of shared terms but not anymore: https://make.wordpress/core/2015/06/09/eliminating-shared-taxonomy-terms-in-wordpress-4-3/
本文标签: Are term IDs unique even between multiple custom taxonomies
版权声明:本文标题:Are term IDs unique even between multiple custom taxonomies 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741323578a2372347.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论