Ticket #10964: simple.10964.diff
File simple.10964.diff, 1.3 KB (added by , 12 years ago) |
---|
-
wp-includes/query.php
2587 2587 if ( !empty( $orderby ) ) 2588 2588 $orderby = 'ORDER BY ' . $orderby; 2589 2589 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"; 2595 2591 if ( !$q['suppress_filters'] ) 2596 2592 $this->request = apply_filters_ref_array('posts_request', array( $this->request, &$this ) ); 2597 2593 … … 2631 2627 } 2632 2628 2633 2629 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 ) ); 2635 2631 $this->found_posts = $wpdb->get_var( $found_posts_query ); 2636 2632 $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) ); 2637 2633 $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);