[wp-trac] [WordPress Trac] #58116: rest_{$this->taxonomy}_query Cache Problem

WordPress Trac noreply at wordpress.org
Wed Apr 12 03:34:38 UTC 2023


#58116: rest_{$this->taxonomy}_query Cache Problem
--------------------------+------------------------------------
 Reporter:  tnolte        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  6.0
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:  rest-api, performance
--------------------------+------------------------------------
Changes (by tnolte):

 * severity:  normal => major


Comment:

 @spacedmonkey so to be very clear this works with WordPress older than
 6.x, and doesn't work for all versions of 6.x, yes I have tested all of
 the versions. This filter is for the taxonomy REST endpoint this isn't a
 simple `get_terms()` call. The REST API calls for taxonomies return a
 count for how many posts are in each term, and when a taxonomy is shared
 between multiple post types you get a total of all posts across the
 associated post types. You can see the endpoint that I'm having problems
 with right here:

 https://vilcek.org/wp-json/wp/v2/country_of_birth/?hide_empty=true

 That example filter I provide works exactly as expected both when the
 Object Cache is empty and when it is filled prior to WordPress 6.x. After
 a WordPress 6.x upgrade, across all versions of 6, the only time that
 filter triggers is when the Object Cache is empty, afterwards all requests
 appear to completely bypass the filter and return the total counts once
 again. You can verify this currently at that endpoint I provided when
 looking at the Bulgaria results and you'll see that the count being
 returned is 2 however if you check both the 2 post type feeds you'll see
 that one of them contains 2 and the other contains 3. If I upgrade the
 site to WP 6.x then the only time I will get a count of 2 is when the
 object cache is empty, after the fact I will only ever get the total count
 across both post types.

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


More information about the wp-trac mailing list