WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/16/2016 02:00:02 AM (6 years ago)
Author:
boonebgorges
Message:

Query: set_found_posts() must run immediately after main query.

If not run immediately after, the SELECT FOUND_ROWS() query might refer to
a different query, such as the one used to populate the post cache for a split
query.

Introduced in [37692].

Fixes #36687.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r37712 r37721  
    36423642                if ( $ids ) {
    36433643                    $this->posts = $ids;
     3644                    $this->set_found_posts( $q, $limits );
    36443645                    _prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
    36453646                } else {
     
    36483649            } else {
    36493650                $this->posts = $wpdb->get_results( $this->request );
    3650             }
    3651         }
    3652 
    3653         $this->set_found_posts( $q, $limits );
     3651                $this->set_found_posts( $q, $limits );
     3652            }
     3653        }
    36543654
    36553655        // Convert to WP_Post objects.
Note: See TracChangeset for help on using the changeset viewer.