Ticket #7415: no_found_rows.diff
File no_found_rows.diff, 1.2 KB (added by , 15 years ago) |
---|
-
wp-includes/query.php
2238 2238 $groupby = 'GROUP BY ' . $groupby; 2239 2239 if ( !empty( $orderby ) ) 2240 2240 $orderby = 'ORDER BY ' . $orderby; 2241 $found_rows = '';2242 if ( !empty($limits) )2243 $found_rows = 'SQL_CALC_FOUND_ROWS';2244 2241 2245 $this->request = " SELECT $ found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";2242 $this->request = " SELECT $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 2246 2243 if ( !$q['suppress_filters'] ) 2247 2244 $this->request = apply_filters('posts_request', $this->request); 2248 2245 … … 2260 2257 } 2261 2258 2262 2259 if ( !empty($limits) ) { 2263 $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()');2260 $found_posts_query = apply_filters( 'found_posts_query', "SELECT COUNT($wpdb->posts.ID) FROM $wpdb->posts $join WHERE 1=1 $where" ); 2264 2261 $this->found_posts = $wpdb->get_var( $found_posts_query ); 2265 2262 $this->found_posts = apply_filters( 'found_posts', $this->found_posts ); 2266 2263 $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);