[wp-trac] [WordPress Trac] #37762: cache_results parameter doesn't prevent queried posts from being added to cache

WordPress Trac noreply at wordpress.org
Wed Jun 15 13:23:14 UTC 2022


#37762: cache_results parameter doesn't prevent queried posts from being added to
cache
--------------------------------------+-----------------------------
 Reporter:  Dang Vu                   |       Owner:  boonebgorges
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  Future Release
Component:  Query                     |     Version:  4.6
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |     Focuses:  performance
--------------------------------------+-----------------------------
Changes (by mukesh27):

 * keywords:   => needs-patch dev-feedback


Comment:

 Hi there!

 This issue still happens if we use the ticket author's suggested code
 snippet.

 {{{#!php
 <?php
 echo count($wp_object_cache->cache['posts']);

 $query = new \WP_Query([
   'post_type' => 'post',
   'cache_results' => false,
   'posts_per_page' => 5,
   'ignore_sticky_posts' => true
 ]);

 echo '<br>' . count($wp_object_cache->cache['posts']);
 }}}


 `dev-feedback` added so we get more eyes on this issue and someone from
 core time will tackle this.

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


More information about the wp-trac mailing list