[wp-trac] [WordPress Trac] #58599: WP_Query->get_posts: cache updated also when query is set to be not cacheable

WordPress Trac noreply at wordpress.org
Mon Jul 24 23:01:03 UTC 2023


#58599: WP_Query->get_posts: cache updated also when query is set to be not
cacheable
--------------------------+------------------------------
 Reporter:  saulirajala   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  6.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+------------------------------

Comment (by peterwilsoncc):

 Replying to [comment:5 saulirajala]:
 > I still find it weird, that the query we explicitly set as non-
 cacheable, is cached after all. It seems to be an contradictory behaviour
 potentially leading to more nasty cache issues.

 I agree it's a little weird but there's some history to it.
 `cache_results` was only ever meant to refer to the main query, the one
 that determines which post IDs to get for the loop, so it would be better
 named `cache_main_query_results`. As it had been around for a while (but
 not doing anything) we were kind of stuck with it. ("we" being those of us
 that worked on #22176.)

 Individual post objects had been cached regardless of the setting for a
 very long time.

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


More information about the wp-trac mailing list