[wp-trac] [WordPress Trac] #22176: Cache the results of the posts_request_ids query

WordPress Trac noreply at wordpress.org
Thu Aug 25 09:47:26 UTC 2022


#22176: Cache the results of the posts_request_ids query
-------------------------------------------------+-------------------------
 Reporter:  ryan                                 |       Owner:
                                                 |  peterwilsoncc
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.1
Component:  Query                                |     Version:  3.4.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch 2nd-opinion has-unit-      |     Focuses:
  tests early needs-testing needs-dev-note       |  performance
  commit                                         |
-------------------------------------------------+-------------------------
Changes (by Chouby):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 I have written a phpunit test which seems to break due to [53941]:

 {{{#!php
 <?php
 public function test_53941() {
         $term_id = $this->factory->term->create( array( 'taxonomy' =>
 'category' ) );
         $post_id = $this->factory->post->create();

         $args = array(
                 'fields'    => 'ids',
                 'tax_query' => array(
                         array(
                                 'taxonomy' => 'category',
                                 'terms'    => array( $term_id ),
                                 'operator' => 'NOT IN',
                         ),
                 ),
         );

         $post_ids = get_posts( $args );
         $this->assertNotEmpty( $post_ids );

         wp_set_object_terms( $post_id, array( $term_id ), 'category' );

         $post_ids = get_posts( $args );
         $this->assertEmpty( $post_ids );
 }
 }}}

 This test passes in WP 6.0.1 as expected. It fails on the second assertion
 in the current development version.

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


More information about the wp-trac mailing list