[wp-trac] [WordPress Trac] #36814: get_the_terms() caches term count property

WordPress Trac noreply at wordpress.org
Sat May 21 17:43:24 UTC 2016

#36814: get_the_terms() caches term count property
 Reporter:  ocean90                       |       Owner:  boonebgorges
     Type:  defect (bug)                  |      Status:  reviewing
 Priority:  normal                        |   Milestone:  4.6
Component:  Taxonomy                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
Changes (by boonebgorges):

 * keywords:  needs-patch => needs-patch needs-unit-tests


 I was hopeful that we'd be able to solve this by switching to ID-only
 queries in #35381, but I've been working on that ticket, and it looks like
 it won't be possible to make that change at this time. So the bug
 described here will have to be addressed separately.

 Two possible strategies:

 1. Stop caching `count`. There's some prior art here - in
 `wp_get_object_terms()`, term cache is handled in such a way that the
 `object_id` property is uncached.
 2. Invalidate term cache when a post is updated that has a
 `term_relationship` with that term.

 I think the second technique is going to be a bit easier. Let me see what
 I can do about a patch.

Ticket URL: <https://core.trac.wordpress.org/ticket/36814#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list