[wp-trac] [WordPress Trac] #32044: is_object_in_term() leaks DB queries

WordPress Trac noreply at wordpress.org
Mon Apr 27 14:47:48 UTC 2015


#32044: is_object_in_term() leaks DB queries
------------------------------------------+--------------------
 Reporter:  joehoyle                      |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  4.3
Component:  Taxonomy                      |     Version:  4.1.1
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+--------------------

Comment (by joehoyle):

 @boonebgorges thanks for looking into it! I had overlooked the whole
 `object` vs `post` thing... does anyone actually use that?! Looking at
 things like `register_taxonomy_for_object_type` it seems a lot of that
 stuff can only use post types, not other object types. Given that
 `get_object_term_cache`'s key is `$id, $taxonomy` I'm not sure how this
 works if you were to use ID: 1 for two different object types - as they'll
 be sharing the same cache keys.

 > I'm going to move this into the 4.3 milestone for further investigation.
 Worst case, we should at least make is_object_in_term() more consistent.
 But maybe we can use this as an excuse to fix term-relationship caches for
 real.

 I think we should at least have `is_object_in_term` update the
 relationship caches. In my somewhat limited experience of contributing to
 core, "use this as an excuse to fix a bigger problem" often means this
 will be left for some time. I'm +1 on making incremental changes to at
 least make it not cause queries when it doesn't need to.

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


More information about the wp-trac mailing list