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

WordPress Trac noreply at wordpress.org
Tue Apr 11 16:05:11 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                  |   Keywords:
  Focuses:  rest-api, performance  |
-----------------------------------+-----------------------------
 This is a follow-up to #55837.

 Every since the terms caching changes in WP 6.0+ there is an issue with
 caching when using the `rest_{$this->taxonomy}_query` filter. This filter
 is apparently bypassed when the cache results are stored and thus only the
 first REST API response has the correct data, following cache responses
 have the wrong data. This is specifically seen when adjusting the query to
 limit the results/returned counts to a specific post-type.


 {{{#!php
 <?php
 function my_rest_some_taxonomy_query( $params ) {
         $params['post_type']   = 'some_custom_post_type';
         $params['post_status'] = 'publish';

         return $params;
 }
 add_filter( 'rest_some_taxonomy_query', 'my_rest_some_taxonomy_query' );
 }}}

 Currently this is blocking us from upgrading past WordPress 5.9 as we
 haven't found how to correct this caching change. I may have to explore
 writing a custom REST API endpoint though I'm not confident that will
 ultimately fix the issue.

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


More information about the wp-trac mailing list