WordPress.org

Make WordPress Core

Ticket #10964: simple.10964.diff

File simple.10964.diff, 1.3 KB (added by scribu, 3 years ago)
  • wp-includes/query.php

     
    25872587                if ( !empty( $orderby ) ) 
    25882588                        $orderby = 'ORDER BY ' . $orderby; 
    25892589 
    2590                 $found_rows = ''; 
    2591                 if ( !$q['no_found_rows'] && !empty($limits) ) 
    2592                         $found_rows = 'SQL_CALC_FOUND_ROWS'; 
    2593  
    2594                 $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 
     2590                $this->request = " SELECT $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 
    25952591                if ( !$q['suppress_filters'] ) 
    25962592                        $this->request = apply_filters_ref_array('posts_request', array( $this->request, &$this ) ); 
    25972593 
     
    26312627                } 
    26322628 
    26332629                if ( !$q['no_found_rows'] && !empty($limits) ) { 
    2634                         $found_posts_query = apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ); 
     2630                        $found_posts_query = apply_filters_ref_array( 'found_posts_query', array( " SELECT COUNT(*) FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby", &$this ) ); 
    26352631                        $this->found_posts = $wpdb->get_var( $found_posts_query ); 
    26362632                        $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) ); 
    26372633                        $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);