Changeset 27210
- Timestamp:
- 02/20/2014 05:53:33 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r27208 r27210 1714 1714 $this->query_vars_changed = false; 1715 1715 1716 do_action_ref_array('parse_query', array(&$this)); 1716 /** 1717 * Fires after the main query vars have been parsed. 1718 * 1719 * @since 1.5.0 1720 * 1721 * @param WP_Query &$this The WP_Query instance (passed by reference). 1722 */ 1723 do_action_ref_array( 'parse_query', array( &$this ) ); 1717 1724 } 1718 1725 … … 1921 1928 $this->tax_query = new WP_Tax_Query( $tax_query ); 1922 1929 1930 /** 1931 * Fires after taxonomy-related query vars have been parsed. 1932 * 1933 * @since 3.7.0 1934 * 1935 * @param WP_Query $this The WP_Query instance. 1936 */ 1923 1937 do_action( 'parse_tax_query', $this ); 1924 1938 } … … 2156 2170 $this->parse_query(); 2157 2171 2158 do_action_ref_array('pre_get_posts', array(&$this)); 2172 /** 2173 * Fires after the query variable object is created, but before the actual query is run. 2174 * 2175 * Note: If using conditional tags, use the method versions within the passed instance 2176 * (e.g. $this->is_main_query() instead of is_main_query()). This is because the functions 2177 * like is_main_query() test against the global $wp_query instance, not the passed one. 2178 * 2179 * @since 2.0.0 2180 * 2181 * @param WP_Query &$this The WP_Query instance (passed by reference). 2182 */ 2183 do_action_ref_array( 'pre_get_posts', array( &$this ) ); 2159 2184 2160 2185 // Shorthand. … … 3147 3172 3148 3173 if ( !$q['suppress_filters'] ) { 3174 /** 3175 * Filter the completed SQL query before sending. 3176 * 3177 * @since 2.0.0 3178 * 3179 * @param array $request The complete SQL query. 3180 * @param WP_Query &$this The WP_Query instance (passed by reference). 3181 */ 3149 3182 $this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) ); 3150 3183 } … … 3171 3204 3172 3205 $split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 ); 3206 3207 /** 3208 * Filter whether to split the query. 3209 * 3210 * Splitting the query will cause it to fetch just the IDs of the found posts 3211 * (and then individually fetch each post by ID), rather than fetching every 3212 * complete row at once. One massive result vs. many small results. 3213 * 3214 * @since 3.4.0 3215 * 3216 * @param bool $split_the_query Whether or not to split the query. 3217 * @param WP_Query $this The WP_Query instance. 3218 */ 3173 3219 $split_the_query = apply_filters( 'split_the_query', $split_the_query, $this ); 3174 3220 … … 3178 3224 $this->request = "SELECT $found_rows $distinct $wpdb->posts.ID FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 3179 3225 3226 /** 3227 * Filter the Post IDs SQL request before sending. 3228 * 3229 * @since 3.4.0 3230 * 3231 * @param string $request The post ID request. 3232 * @param WP_Query $this The WP_Query instance. 3233 */ 3180 3234 $this->request = apply_filters( 'posts_request_ids', $this->request, $this ); 3181 3235 … … 3198 3252 $this->posts = array_map( 'get_post', $this->posts ); 3199 3253 3200 // Raw results filter. Prior to status checks. 3201 if ( !$q['suppress_filters'] ) 3202 $this->posts = apply_filters_ref_array('posts_results', array( $this->posts, &$this ) ); 3254 if ( ! $q['suppress_filters'] ) { 3255 /** 3256 * Filter the raw post results array, prior to status checks. 3257 * 3258 * @since 2.3.0 3259 * 3260 * @param array $posts The post results array. 3261 * @param WP_Query &$this The WP_Query instance (passed by reference). 3262 */ 3263 $this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) ); 3264 } 3203 3265 3204 3266 if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) { … … 3253 3315 } 3254 3316 3255 if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) 3317 if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) { 3318 /** 3319 * Filter the single post for preview mode. 3320 * 3321 * @since 2.7.0 3322 * 3323 * @param WP_Post $post_preview The Post object. 3324 * @param WP_Query &$this The WP_Query instance (passed by reference). 3325 */ 3256 3326 $this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) ); 3327 } 3257 3328 } 3258 3329 … … 3298 3369 } 3299 3370 3300 if ( !$q['suppress_filters'] ) 3301 $this->posts = apply_filters_ref_array('the_posts', array( $this->posts, &$this ) ); 3371 if ( ! $q['suppress_filters'] ) { 3372 /** 3373 * Filter the array of retrieved posts after they've been fetched and 3374 * internally processed. 3375 * 3376 * @since 1.5.0 3377 * 3378 * @param array $posts The array of retrieved posts. 3379 * @param WP_Query &$this The WP_Query instance (passed by reference). 3380 */ 3381 $this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) ); 3382 } 3302 3383 3303 3384 // Ensure that any posts added/modified via one of the filters above are … … 3335 3416 return; 3336 3417 3337 if ( ! empty( $limits ) ) 3418 if ( ! empty( $limits ) ) { 3419 /** 3420 * Filter the query to run for retrieving the found posts. 3421 * 3422 * @since 2.1.0 3423 * 3424 * @param string $found_posts The query to run to find the found posts. 3425 * @param WP_Query &$this The WP_Query instance (passed by reference). 3426 */ 3338 3427 $this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) ); 3339 else3428 } else { 3340 3429 $this->found_posts = count( $this->posts ); 3341 3430 } 3431 3432 /** 3433 * Filter the number of found posts for the query. 3434 * 3435 * @since 2.1.0 3436 * 3437 * @param int $found_posts The number of posts found. 3438 * @param WP_Query &$this The WP_Query instance (passed by reference). 3439 */ 3342 3440 $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) ); 3343 3441 … … 3378 3476 3379 3477 if ( $this->current_post == -1 ) // loop has just started 3380 do_action_ref_array('loop_start', array(&$this)); 3478 /** 3479 * Fires once the loop is started. 3480 * 3481 * @since 2.0.0 3482 * 3483 * @param WP_Query &$this The WP_Query instance (passed by reference). 3484 */ 3485 do_action_ref_array( 'loop_start', array( &$this ) ); 3381 3486 3382 3487 $post = $this->next_post(); … … 3399 3504 return true; 3400 3505 } elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) { 3401 do_action_ref_array('loop_end', array(&$this)); 3506 /** 3507 * Fires once the loop has ended. 3508 * 3509 * @since 2.0.0 3510 * 3511 * @param WP_Query &$this The WP_Query instance (passed by reference). 3512 */ 3513 do_action_ref_array( 'loop_end', array( &$this ) ); 3402 3514 // Do some cleaning up after the loop 3403 3515 $this->rewind_posts(); … … 3450 3562 3451 3563 if ( $this->current_comment == 0 ) { 3452 do_action('comment_loop_start'); 3564 /** 3565 * Fires once the comment loop is started. 3566 * 3567 * @since 2.2.0 3568 */ 3569 do_action( 'comment_loop_start' ); 3453 3570 } 3454 3571 } … … 4243 4360 } 4244 4361 4245 do_action_ref_array('the_post', array(&$post)); 4362 /** 4363 * Fires once the post data has been setup. 4364 * 4365 * @since 2.8.0 4366 * 4367 * @param WP_Post &$post The Post object (passed by reference). 4368 */ 4369 do_action_ref_array( 'the_post', array( &$post ) ); 4246 4370 4247 4371 return true;
Note: See TracChangeset
for help on using the changeset viewer.