[wp-trac] [WordPress Trac] #57012: WP_Query caching discards `posts_fields` and `posts_clauses['fields']` filters.

WordPress Trac noreply at wordpress.org
Mon Nov 7 00:37:07 UTC 2022


#57012: WP_Query caching discards `posts_fields` and `posts_clauses['fields']`
filters.
---------------------------+--------------------
 Reporter:  peterwilsoncc  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  6.1.1
Component:  Query          |    Version:  6.1
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+--------------------
 When generating the cache key, `WP_Query` uses a consistent value for the
 fields requested in the `SELECT` clause.

 In most cases, this is problem free as `WP_Query` uses the same cache
 regardless of the fields requested. When a plugin is filtering the fields
 returned, this can be problematic as the cache key could cause collisions
 in some circumstances.

 When generating the cache key, `WP_Query` should consider the fields value
 if it has been modified by a plugin. This may also affect what needs to be
 cached.

 I'm still investigating this so will add further notes to the ticket. I'm
 putting this on the 6.1.1 milestone for visibility.

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


More information about the wp-trac mailing list