[wp-trac] [WordPress Trac] #32044: is_object_in_term() leaks DB queries
WordPress Trac
noreply at wordpress.org
Tue Apr 21 19:30:04 UTC 2015
#32044: is_object_in_term() leaks DB queries
--------------------------+-----------------------------
Reporter: joehoyle | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache API | Version: 4.1.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
`is_object_in_term()` should either use the Object Cache'd term
relationships and populate the cache for next time, or not use them at
all. Currently, `is_object_in_term()` reads from the cache with
`get_object_term_cache()`, and falls back to `wp_get_object_terms()` - in
that case, it doesn't then update the post-term relationship caches for
next time.
I'm not sure if `is_object_in_term()` is meant to respect object cache'd
relationships or not - but right now its doing it half way. I don't quite
know the history of the post-term relationships not being all that trusted
(which is presumably why there is `wp_get_obejct_terms()` and
`get_the_terms()` however, it seems just using the `get_the_terms` instead
of `wp_get_object_terms` with have no regressions in this case, and cause
the cache to be primed for 'next time'.
Attached patch does just that.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32044>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list