[wp-trac] [WordPress Trac] #34533: Term splitting in `get_term()` can have unexpected effects

WordPress Trac noreply at wordpress.org
Thu Nov 5 16:08:37 UTC 2015


#34533: Term splitting in `get_term()` can have unexpected effects
--------------------------+---------------------------
 Reporter:  dlh           |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  assigned
 Priority:  high          |   Milestone:  4.4
Component:  Taxonomy      |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------

Comment (by boonebgorges):

 Thanks for the feedback, @dlh.

 > One other potential issue is that get_term( $term_id ) could get a term
 from an invalid taxonomy

 Hrm, yeah. If you pass an invalid `$taxonomy` to `get_term()`, it will of
 course return a `WP_Error`. What we can definitely do is add a bit of
 extra logic before bailing from `WP_Term::get_instance()` with
 'ambiguous_term_id', so that a term shared between a valid and an invalid
 taxonomy will return the term from the valid taxonomy, rather than an
 error.

 However, in the simpler case where you have an *unshared* term in an
 invalid taxonomy, I'm not sure what the proper behavior should be. It
 would be easy enough to bail with an `invalid_taxonomy` error if the
 located term is from an invalid taxonomy. But then it'll be effectively
 impossible to pull up that data through the API. That said, I guess it is
 already impossible to do so? Like, you could have terms in the database
 that are inaccessible because the taxonomy has been unregistered? So maybe
 this is the thing to do here too.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34533#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list