A related WPSE question asks how to get the term by specifying ID only, without specifying taxonomy. My question is more philosophical. Generally, stuff in WP core is there for a reason. I’m trying to understand why term_id can’t be the primary key for the term – why do we need the taxonomy as well? Can a single term record be a member of multiple taxonomies? That’s certainly not currently supported in the API. Is there a use case where this might be desirable?

Or is the required $taxonomy parameter in get_term() a vestigial tail from an earlier incarnation of the database structure?

2 s
2

I’ve logged a ticket against this with trac: http://core.trac.wordpress.org/ticket/20536

However, it turns out that for the time being it IS necessary, as WordPress currently (since 2.x) has a bug that DOES associate two terms with the same name to the same term_id! So it IS possible (though incorrect) for a single term to be associated with more than one taxonomy. See this bug: http://core.trac.wordpress.org/ticket/5809

It’s pretty wide-reaching so implementing the fix will need to be unit-tested very thoroughly. I’ll try to remember to update this question if there are any developments.

Leave a Reply

Your email address will not be published. Required fields are marked *