WordPress.org

Make WordPress Core

Ticket #20628: 20628.diff

File 20628.diff, 674 bytes (added by ryan, 2 years ago)

split_the_query filter. Don't split if no limit.

  • wp-includes/query.php

     
    26262626                        return $r; 
    26272627                } 
    26282628 
    2629                 if ( $old_request == $this->request && "$wpdb->posts.*" == $fields ) { 
     2629                $split_the_query = apply_filters( 'split_the_query', ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits) ), $this ); 
     2630 
     2631                if ( $split_the_query ) { 
    26302632                        // First get the IDs and then fill in the objects 
    26312633 
    26322634                        $this->request = "SELECT $found_rows $distinct $wpdb->posts.ID FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";