0

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?

2 Answers 2

2

The 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"

1
  • 1
    You said no but your explanations are saying yes. Commented Jul 27, 2021 at 11:16
0

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.org/core/2015/06/09/eliminating-shared-taxonomy-terms-in-wordpress-4-3/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.