[wp-trac] [WordPress Trac] #20536: Make $taxonomy an optional argument to &get_term()

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 24 17:57:30 UTC 2012


#20536: Make $taxonomy an optional argument to &get_term()
-------------------------+-----------------------------
 Reporter:  TomAuger     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Taxonomy     |    Version:
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 Looks like a vestigial tail to me.


 {{{
 function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw'){}
 }}}

 $term is expected to be a term object (which is then converted to the
 (int) ID) or it can be an (int) ID.

 Either way, there's no ambiguity that needs $taxonomy in order to be
 resolved. In fact, just by knowing the term's ID, you can get at the
 $taxonomy through a join to wp_term_taxonomy because term_id is unique.
 Even two terms with the same name would have different IDs and a single
 term_ID will not be associated with multiple wp_term_taxonomy records
 (although the database table IS built as a M<-->M intersection table which
 such a relationship is possible, WordPress doesn't re-use term records
 that way.)

 I"m not suggesting we rewrite the whole taxonomy database. But until /
 unless the term-taxonomy relationship becomes a M2M one, I suggest we make
 the $taxonomy argument optional.

 The benefit (aside from refactoring redundant logic) is that plugin
 developers can more easily query a term, without having to separately dig
 up that term's taxonomy, which is a trivial, but useless exercise from a
 database point of view.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20536>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list