| 2236 | | $where = apply_filters('posts_where_paged', $where); |
| 2237 | | $groupby = apply_filters('posts_groupby', $groupby); |
| 2238 | | $join = apply_filters('posts_join_paged', $join); |
| | 2242 | $distinct = apply_filters('posts_distinct', $distinct, false); |
| | 2243 | $quick_distinct = apply_filters('posts_distinct', $quick_distinct, true); |
| | 2244 | |
| | 2245 | $fields = apply_filters('posts_fields', $fields, false); |
| | 2246 | $quick_fields = apply_filters('posts_fields', $quick_fields, true); |
| | 2247 | |
| | 2248 | $join = apply_filters('posts_join_paged', $join, false); |
| | 2249 | $quick_join = apply_filters('posts_join_paged', $quick_join, true); |
| | 2250 | |
| | 2251 | $where = apply_filters('posts_where_paged', $where, false); |
| | 2252 | $quick_where = apply_filters('posts_where_paged', $quick_where, true); |
| | 2253 | |
| | 2254 | $groupby = apply_filters('posts_groupby', $groupby, true); |
| | 2255 | $quick_groupby = apply_filters('posts_groupby', $quick_groupby, true); |
| | 2256 | |
| 2251 | | $where = apply_filters('posts_where_request', $where); |
| 2252 | | $groupby = apply_filters('posts_groupby_request', $groupby); |
| 2253 | | $join = apply_filters('posts_join_request', $join); |
| | 2266 | $distinct = apply_filters('posts_distinct_request', $distinct, false); |
| | 2267 | $quick_distinct = apply_filters('posts_distinct_request', $quick_distinct, true); |
| | 2268 | |
| | 2269 | $fields = apply_filters('posts_fields_request', $fields, false); |
| | 2270 | $quick_fields = apply_filters('posts_fields_request', $quick_fields, true); |
| | 2271 | |
| | 2272 | $join = apply_filters('posts_join_request', $join, false); |
| | 2273 | $quick_join = apply_filters('posts_join_request', $quick_join, true); |
| | 2274 | |
| | 2275 | $where = apply_filters('posts_where_request', $where, false); |
| | 2276 | $quick_where = apply_filters('posts_where_request', $quick_where, true); |
| | 2277 | |
| | 2278 | $groupby = apply_filters('posts_groupby_request', $groupby, false); |
| | 2279 | $quick_groupby = apply_filters('posts_groupby_request', $quick_groupby, true); |
| | 2280 | |
| 2272 | | $this->posts = $wpdb->get_results($this->request); |
| | 2298 | if ( !$q['suppress_filters'] ) { |
| | 2299 | $this->request = apply_filters('posts_request', $this->request, false); |
| | 2300 | $this->quick_request = apply_filters('posts_request', $this->quick_request, true); |
| | 2301 | } |
| | 2302 | |
| | 2303 | $this->posts = $wpdb->get_results($this->quick_request); |
| | 2304 | |
| | 2305 | $this->found_posts = count($this->posts); |
| | 2306 | $this->found_posts = apply_filters( 'found_posts', $this->found_posts ); |
| | 2307 | $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); |
| | 2308 | } else { |
| | 2309 | $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits "; |
| | 2310 | if ( !$q['suppress_filters'] ) |
| | 2311 | $this->request = apply_filters('posts_request', $this->request, false); |
| | 2312 | |
| | 2313 | $post_ids = $wpdb->get_col($this->request); |
| | 2314 | |
| | 2315 | if ( !$post_ids ) { |
| | 2316 | $this->found_posts = 0; |
| | 2317 | $this->found_posts = apply_filters( 'found_posts', $this->found_posts ); |
| | 2318 | $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); |
| | 2319 | |
| | 2320 | $this->quick_request = " SELECT $distinct $quick_fields FROM $wpdb->posts $quick_join WHERE 1=1 $quick_where $quick_groupby $orderby"; |
| | 2321 | if ( !$q['suppress_filters'] ) |
| | 2322 | $this->quick_request = apply_filters('posts_request', $this->quick_request, true); |
| | 2323 | $this->posts = array(); // no point in querying, since there are no posts |
| | 2324 | } else { |
| | 2325 | $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()' ); |
| | 2326 | $this->found_posts = $wpdb->get_var( $found_posts_query ); |
| | 2327 | $this->found_posts = apply_filters( 'found_posts', $this->found_posts ); |
| | 2328 | $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); |
| | 2329 | |
| | 2330 | $this->quick_request = " SELECT $quick_distinct $quick_fields FROM $wpdb->posts $quick_join WHERE 1 = 1 $quick_where AND $wpdb->posts.ID IN ( " . implode(',', $post_ids) . " ) $quick_groupby $orderby "; |
| | 2331 | if ( !$q['suppress_filters'] ) |
| | 2332 | $this->quick_request = apply_filters('posts_request', $this->quick_request, true); |
| | 2333 | |
| | 2334 | $this->posts = $wpdb->get_results($this->quick_request); |
| | 2335 | } |
| | 2336 | } |
| | 2337 | |