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

WordPress Trac noreply at wordpress.org
Mon Apr 27 15:04:08 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 boonebgorges):

 Replying to [comment:6 joehoyle]:
 > Ah, sorry missed that we needed the type to call
 `update_object_term_cache`. However, I don't see why we can't do
 `wp_cache_add($object_id, $terms, $taxonomy . '_relationships');` it's
 going to read that exact cache key via `is_object_in_term`

 The current behavior is '{$taxonomy}_relationships' will only include
 relationships with post type objects. Updating the cache in
 `is_object_in_term()` will change the behavior by adding non-post-type
 objects. I'm not sure whether or how this change will manifest itself, but
 surely it'll cause bugs somewhere, so I want to be conservative about
 modifying what gets cached.

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


More information about the wp-trac mailing list