WordPress.org

Make WordPress Core

Ticket #20628: 20628.2.diff

File 20628.2.diff, 720 bytes (added by SergeyBiryukov, 2 years ago)

Check $limits (potentially filtered, e.g. via post_limits)

  • wp-includes/query.php

     
    26262626                        return $r; 
    26272627                } 
    26282628 
    2629                 $split_the_query = apply_filters( 'split_the_query', ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits) ), $this ); 
     2629                $split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && preg_replace( '/LIMIT ([0-9]+,)*/i', '', $limits ) < 500 ); 
     2630                $split_the_query = apply_filters( 'split_the_query', $split_the_query, $this ); 
    26302631 
    26312632                if ( $split_the_query ) { 
    26322633                        // First get the IDs and then fill in the objects