Make WordPress Core

Ticket #25514: WP_Query-hook-docs-rev1.diff

File WP_Query-hook-docs-rev1.diff, 22.4 KB (added by dougwollison, 10 years ago)

Updated revised diff; fixed consistency when mentioning "WP_Query object"

  • wp-includes/query.php

     
    17091709                $this->query_vars_hash = md5( serialize( $this->query_vars ) );
    17101710                $this->query_vars_changed = false;
    17111711
    1712                 do_action_ref_array('parse_query', array(&$this));
     1712                /**
     1713                 * Fires actions to be run after parse_query is complete.
     1714                 *
     1715                 * @since 1.5.2
     1716                 *
     1717                 * @param array $args {
     1718                 *              The variables passed to the callback.
     1719                 *
     1720                 *              @type WP_Query &$this The WP_Query object (passed by reference).
     1721                 * }
     1722                 */
     1723                do_action_ref_array( 'parse_query', array( &$this ) );
    17131724        }
    17141725
    17151726        /*
     
    19031914
    19041915                $this->tax_query = new WP_Tax_Query( $tax_query );
    19051916
     1917                /**
     1918                 * Fires actions to be run after parse_tax_query is complete.
     1919                 *
     1920                 * @since 3.7.0
     1921                 *
     1922                 * @param WP_Query $this The WP_Query object.
     1923                 */
    19061924                do_action( 'parse_tax_query', $this );
    19071925        }
    19081926
     
    19631981                 *
    19641982                 * @since 3.0.0
    19651983                 *
    1966                  * @param string   $search Search SQL for WHERE clause.
    1967                  * @param WP_Query $this   The current WP_Query object.
     1984                 * @param array $args {
     1985                 *              The variables passed to the callback.
     1986                 *
     1987                 *              @type string   $search Search SQL for WHERE clause.
     1988                 *              @type WP_Query $this   The current WP_Query object.
     1989                 * }
    19681990                 */
    19691991                return apply_filters_ref_array( 'posts_search', array( $search, &$this ) );
    19701992        }
     
    21442166
    21452167                $this->parse_query();
    21462168
    2147                 do_action_ref_array('pre_get_posts', array(&$this));
     2169                /**
     2170                 * Fires actions to run after parse_query and before get_posts actually begins.
     2171                 *
     2172                 * @since 2.0.0
     2173                 *
     2174                 * @param array $args {
     2175                 *              The variables passed to the callback.
     2176                 *
     2177                 *              @type WP_Query $this   The current WP_Query object.
     2178                 * }
     2179                 */
     2180                do_action_ref_array( 'pre_get_posts', array( &$this ) );
    21482181
    21492182                // Shorthand.
    21502183                $q = &$this->query_vars;
     
    27742807                // Apply filters on where and join prior to paging so that any
    27752808                // manipulations to them are reflected in the paging by day queries.
    27762809                if ( !$q['suppress_filters'] ) {
    2777                         $where = apply_filters_ref_array('posts_where', array( $where, &$this ) );
    2778                         $join = apply_filters_ref_array('posts_join', array( $join, &$this ) );
     2810                        /**
     2811                         * Filter the WHERE portion of the posts query before sending.
     2812                         *
     2813                         * @since 1.5.2
     2814                         *
     2815                         * @param array $args {
     2816                         *              The variables passed to the callback.
     2817                         *
     2818                         *              @type string   $where The WHERE portion of the query.
     2819                         *              @type WP_Query $this  The current WP_Query object.
     2820                         * }
     2821                         */
     2822                        $where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) );
     2823
     2824                        /**
     2825                         * Filter the JOIN portion of the posts query before sending.
     2826                         *
     2827                         * @since 1.5.2
     2828                         *
     2829                         * @param array $args {
     2830                         *              The variables passed to the callback.
     2831                         *
     2832                         *              @type $join    $where The JOIN portion of the query.
     2833                         *              @type WP_Query $this  The current WP_Query object.
     2834                         * }
     2835                         */
     2836                        $join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );
    27792837                }
    27802838
    27812839                // Paging
     
    28062864                        }
    28072865
    28082866                        if ( !$q['suppress_filters'] ) {
    2809                                 $cjoin = apply_filters_ref_array('comment_feed_join', array( $cjoin, &$this ) );
    2810                                 $cwhere = apply_filters_ref_array('comment_feed_where', array( $cwhere, &$this ) );
    2811                                 $cgroupby = apply_filters_ref_array('comment_feed_groupby', array( $cgroupby, &$this ) );
    2812                                 $corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
    2813                                 $climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
     2867                                /**
     2868                                 * Filter the JOIN portion of the comments feed query before sending.
     2869                                 *
     2870                                 * @since 1.5.2
     2871                                 *
     2872                                 * @param array $args {
     2873                                 *              The variables passed to the callback.
     2874                                 *
     2875                                 *              @type string   $cjoin The JOIN portion of the query.
     2876                                 *              @type WP_Query &$this The WP_Query object (passed by refrence).
     2877                                 * }
     2878                                 */
     2879                                $cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );
     2880
     2881                                /**
     2882                                 * Filter the WHERE portion of the comments feed query before sending.
     2883                                 *
     2884                                 * @since 1.5.2
     2885                                 *
     2886                                 * @param array $args {
     2887                                 *              The variables passed to the callback.
     2888                                 *
     2889                                 *              @type string   $cwhere The WHERE portion of the query.
     2890                                 *              @type WP_Query &$this  The WP_Query object (passed by refrence).
     2891                                 * }
     2892                                 */
     2893                                 */
     2894                                $cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );
     2895
     2896                                /**
     2897                                 * Filter the GROUP BY portion of the comments feed query before sending.
     2898                                 *
     2899                                 * @since 1.5.2
     2900                                 *
     2901                                 * @param array $args {
     2902                                 *              The variables passed to the callback.
     2903                                 *
     2904                                 *              @type string   $cgroupby The GROUP BY portion of the query.
     2905                                 *              @type WP_Query &$this    The WP_Query object (passed by refrence).
     2906                                 * }
     2907                                 */
     2908                                $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );
     2909
     2910                                /**
     2911                                 * Filter the ORDER BY portion of the comments feed query before sending.
     2912                                 *
     2913                                 * @since 1.5.2
     2914                                 *
     2915                                 * @param array $args {
     2916                                 *              The variables passed to the callback.
     2917                                 *
     2918                                 *              @type string   $corderby The ORDER BY portion of the query.
     2919                                 *              @type WP_Query &$this    The WP_Query object (passed by refrence).
     2920                                 * }
     2921                                 */
     2922                                $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
     2923
     2924                                /**
     2925                                 * Filter the LIMIT portion of the comments feed query before sending.
     2926                                 *
     2927                                 * @since 1.5.2
     2928                                 *
     2929                                 * @param array $args {
     2930                                 *              The variables passed to the callback.
     2931                                 *
     2932                                 *              @type string   $climits The JOIN portion of the query.
     2933                                 *              @type WP_Query &$this   The WP_Query object (passed by refrence).
     2934                                 * }
     2935                                 */
     2936                                $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
    28142937                        }
    28152938                        $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
    28162939                        $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
     
    28362959                // Apply post-paging filters on where and join. Only plugins that
    28372960                // manipulate paging queries should use these hooks.
    28382961                if ( !$q['suppress_filters'] ) {
     2962                        /**
     2963                         * Filter the WHERE portion of the posts query before sending.
     2964                         *
     2965                         * @since 1.5.2
     2966                         *
     2967                         * @param array $args {
     2968                         *              The variables passed to the callback.
     2969                         *
     2970                         *              @type string   $where The WHERE portion of the query.
     2971                         *              @type WP_Query &$this The WP_Query object (passed by refrence).
     2972                         * }
     2973                         */
    28392974                        $where          = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
     2975
     2976                        /**
     2977                         * Filter the GROUP BY portion of the posts query before sending.
     2978                         *
     2979                         * @since 2.0.0
     2980                         *
     2981                         * @param array $args {
     2982                         *              The variables passed to the callback.
     2983                         *
     2984                         *              @type string   $groupby The GROUP BY portion of the query.
     2985                         *              @type WP_Query &$this   The WP_Query object (passed by refrence).
     2986                         * }
     2987                         */
    28402988                        $groupby        = apply_filters_ref_array( 'posts_groupby',             array( $groupby, &$this ) );
     2989
     2990                        /**
     2991                         * Filter the JOIN portion of the posts query before sending.
     2992                         *
     2993                         * @since 1.5.2
     2994                         *
     2995                         * @param array $args {
     2996                         *              The variables passed to the callback.
     2997                         *
     2998                         *              @type string   $join  The JOIN portion of the query.
     2999                         *              @type WP_Query &$this The WP_Query object (passed by refrence).
     3000                         * }
     3001                         */
    28413002                        $join           = apply_filters_ref_array( 'posts_join_paged',  array( $join, &$this ) );
     3003
     3004                        /**
     3005                         * Filter the ORDER BY portion of the posts query before sending.
     3006                         *
     3007                         * @since 1.5.2
     3008                         *
     3009                         * @param array $args {
     3010                         *              The variables passed to the callback.
     3011                         *
     3012                         *              @type string   $orderby The ORDER BY portion of the query.
     3013                         *              @type WP_Query &$this   The WP_Query object (passed by refrence).
     3014                         * }
     3015                         */
    28423016                        $orderby        = apply_filters_ref_array( 'posts_orderby',             array( $orderby, &$this ) );
     3017
     3018                        /**
     3019                         * Filter the DISTINCT portion of the posts query before sending.
     3020                         *
     3021                         * @since 2.1.0
     3022                         *
     3023                         * @param array $args {
     3024                         *              The variables passed to the callback.
     3025                         *
     3026                         *              @type string   $distinct The DISTINCT portion of the query.
     3027                         *              @type WP_Query &$this    The WP_Query object (passed by refrence).
     3028                         * }
     3029                         */
    28433030                        $distinct       = apply_filters_ref_array( 'posts_distinct',    array( $distinct, &$this ) );
     3031
     3032                        /**
     3033                         * Filter the LIMIT portion of the posts query before sending.
     3034                         *
     3035                         * @since 2.1.0
     3036                         *
     3037                         * @param array $args {
     3038                         *              The variables passed to the callback.
     3039                         *
     3040                         *              @type string   $limits The LIMIT portion of the query.
     3041                         *              @type WP_Query &$this  The WP_Query object (passed by refrence).
     3042                         * }
     3043                         */
    28443044                        $limits         = apply_filters_ref_array( 'post_limits',               array( $limits, &$this ) );
     3045
     3046                        /**
     3047                         * Filter the SELECT portion of the posts query before sending.
     3048                         *
     3049                         * @since 2.1.0
     3050                         *
     3051                         * @param array $args {
     3052                         *              The variables passed to the callback.
     3053                         *
     3054                         *              @type string   $fields The SELECT portion of the query.
     3055                         *              @type WP_Query &$this  The WP_Query object (passed by refrence).
     3056                         * }
     3057                         */
    28453058                        $fields         = apply_filters_ref_array( 'posts_fields',              array( $fields, &$this ) );
    28463059
    2847                         // Filter all clauses at once, for convenience
     3060                        /**
     3061                         * Filter all clauses at once, for convenience.
     3062                         *
     3063                         * @since 3.1.0
     3064                         *
     3065                         * @param array $args {
     3066                         *              The variables passed to the callback.
     3067                         *
     3068                         *              @type string   $pieces The pieces of the query.
     3069                         *              @type WP_Query &$this  The WP_Query object (passed by refrence).
     3070                         * }
     3071                         */
    28483072                        $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
     3073
    28493074                        foreach ( $pieces as $piece )
    28503075                                $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : '';
    28513076                }
    28523077
    28533078                // Announce current selection parameters. For use by caching plugins.
     3079                /**
     3080                 * Fires actions to be run once post selection preperation has been completed.
     3081                 *
     3082                 * Largely for use by caching plugins.
     3083                 *
     3084                 * @since 2.3.0
     3085                 *
     3086                 * @param array $args {
     3087                 *              The variables passed to the callback.
     3088                 *
     3089                 *              @type string   $selection The assembled selection query.
     3090                 *              @type WP_Query &$this     The WP_Query object (passed by refrence).
     3091                 * }
     3092                 */
    28543093                do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
    28553094
    28563095                // Filter again for the benefit of caching plugins. Regular plugins should use the hooks above.
    28573096                if ( !$q['suppress_filters'] ) {
     3097                        /**
     3098                         * Filter the WHERE portion of the posts query before sending.
     3099                         *
     3100                         * @since 2.5.0
     3101                         *
     3102                         * @param array $args {
     3103                         *              The variables passed to the callback.
     3104                         *
     3105                         *              @type string   $where The WHERE portion of the query.
     3106                         *              @type WP_Query &$this The WP_Query object (passed by refrence).
     3107                         * }
     3108                         */
    28583109                        $where          = apply_filters_ref_array( 'posts_where_request',               array( $where, &$this ) );
     3110
     3111                        /**
     3112                         * Filter the GROUP BY portion of the posts query before sending.
     3113                         *
     3114                         * @since 2.5.0
     3115                         *
     3116                         * @param array $args {
     3117                         *              The variables passed to the callback.
     3118                         *
     3119                         *              @type string   $groupby The GROUP BY portion of the query.
     3120                         *              @type WP_Query &$this   The WP_Query object (passed by refrence).
     3121                         * }
     3122                         */
    28593123                        $groupby        = apply_filters_ref_array( 'posts_groupby_request',             array( $groupby, &$this ) );
     3124
     3125                        /**
     3126                         * Filter the JOIN portion of the posts query before sending.
     3127                         *
     3128                         * @since 2.5.0
     3129                         *
     3130                         * @param array $args {
     3131                         *              The variables passed to the callback.
     3132                         *
     3133                         *              @type string   $join  The JOIN portion of the query.
     3134                         *              @type WP_Query &$this The WP_Query object (passed by refrence).
     3135                         * }
     3136                         */
    28603137                        $join           = apply_filters_ref_array( 'posts_join_request',                array( $join, &$this ) );
     3138
     3139                        /**
     3140                         * Filter the ORDER BY portion of the posts query before sending.
     3141                         *
     3142                         * @since 2.5.0
     3143                         *
     3144                         * @param array $args {
     3145                         *              The variables passed to the callback.
     3146                         *
     3147                         *              @type string   $orderby The ORDER BY portion of the query.
     3148                         *              @type WP_Query &$this   The WP_Query object (passed by refrence).
     3149                         * }
     3150                         */
    28613151                        $orderby        = apply_filters_ref_array( 'posts_orderby_request',             array( $orderby, &$this ) );
     3152
     3153                        /**
     3154                         * Filter the DISTINCT portion of the posts query before sending.
     3155                         *
     3156                         * @since 2.5.0
     3157                         *
     3158                         * @param array $args {
     3159                         *              The variables passed to the callback.
     3160                         *
     3161                         *              @type string   $distinct The DISTINCT portion of the query.
     3162                         *              @type WP_Query &$this    The WP_Query object (passed by refrence).
     3163                         * }
     3164                         */
    28623165                        $distinct       = apply_filters_ref_array( 'posts_distinct_request',    array( $distinct, &$this ) );
     3166
     3167                        /**
     3168                         * Filter the SELECT portion of the posts query before sending.
     3169                         *
     3170                         * @since 2.5.0
     3171                         *
     3172                         * @param array $args {
     3173                         *              The variables passed to the callback.
     3174                         *
     3175                         *              @type string   $fields The SELECT portion of the query.
     3176                         *              @type WP_Query &$this  The WP_Query object (passed by refrence).
     3177                         * }
     3178                         */
    28633179                        $fields         = apply_filters_ref_array( 'posts_fields_request',              array( $fields, &$this ) );
     3180
     3181                        /**
     3182                         * Filter the LIMIT portion of the posts query before sending.
     3183                         *
     3184                         * @since 2.5.0
     3185                         *
     3186                         * @param array $args {
     3187                         *              The variables passed to the callback.
     3188                         *
     3189                         *              @type string   $limits The LIMIT portion of the query.
     3190                         *              @type WP_Query &$this  The WP_Query object (passed by refrence).
     3191                         * }
     3192                         */
    28643193                        $limits         = apply_filters_ref_array( 'post_limits_request',               array( $limits, &$this ) );
    28653194
    2866                         // Filter all clauses at once, for convenience
     3195                        /**
     3196                         * Filter all clauses at once, for convenience.
     3197                         *
     3198                         * @since 3.1.0
     3199                         *
     3200                         * @param array $args {
     3201                         *              The variables passed to the callback.
     3202                         *
     3203                         *              @type string   $pieces The pieces of the query.
     3204                         *              @type WP_Query &$this  The WP_Query object (passed by refrence).
     3205                         * }
     3206                         */
    28673207                        $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
    28683208                        foreach ( $pieces as $piece )
    28693209                                $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : '';
     
    28813221                $this->request = $old_request = "SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
    28823222
    28833223                if ( !$q['suppress_filters'] ) {
     3224                        /**
     3225                         * Filter the completed SQL query before sending.
     3226                         *
     3227                         * @since 2.0.0
     3228                         *
     3229                         * @param array $args {
     3230                         *              The variables passed to the callback.
     3231                         *
     3232                         *              @type string   $request The complete SQL query.
     3233                         *              @type WP_Query &$this   The WP_Query object (passed by refrence).
     3234                         * }
     3235                         */
    28843236                        $this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
    28853237                }
    28863238
     
    29053257                }
    29063258
    29073259                $split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 );
     3260
     3261                /**
     3262                 * Filter the $split_the_query boolean.
     3263                 *
     3264                 * @since 3.4.0
     3265                 *
     3266                 * @param array $args {
     3267                 *              The variables passed to the callback.
     3268                 *
     3269                 *              @type string   $split_the_query Whether or not to split the query.
     3270                 *              @type WP_Query $this            The WP_Query object.
     3271                 * }
     3272                 */
    29083273                $split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );
    29093274
    29103275                if ( $split_the_query ) {
     
    29123277
    29133278                        $this->request = "SELECT $found_rows $distinct $wpdb->posts.ID FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
    29143279
     3280                        /**
     3281                         * Filter the Post ID request before sending.
     3282                         *
     3283                         * @since 3.4.0
     3284                         *
     3285                         * @param array $args {
     3286                         *              The variables passed to the callback.
     3287                         *
     3288                         *              @type string   $request The post ID request.
     3289                         *              @type WP_Query $this    The WP_Query object.
     3290                         * }
     3291                         */
    29153292                        $this->request = apply_filters( 'posts_request_ids', $this->request, $this );
    29163293
    29173294                        $ids = $wpdb->get_col( $this->request );
     
    29323309                if ( $this->posts )
    29333310                        $this->posts = array_map( 'get_post', $this->posts );
    29343311
    2935                 // Raw results filter. Prior to status checks.
    29363312                if ( !$q['suppress_filters'] )
    2937                         $this->posts = apply_filters_ref_array('posts_results', array( $this->posts, &$this ) );
     3313                        /**
     3314                         * Filter the raw post results array, prior to status checks.
     3315                         *
     3316                         * @since 2.3.0
     3317                         *
     3318                         * @param array $args {
     3319                         *              The variables passed to the callback.
     3320                         *
     3321                         *              @type string   $posts The post results array.
     3322                         *              @type WP_Query &$this The WP_Query object (passed by reference).
     3323                         * }
     3324                         */
     3325                        $this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) );
    29383326
    29393327                if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
    2940                         $cjoin = apply_filters_ref_array('comment_feed_join', array( '', &$this ) );
    2941                         $cwhere = apply_filters_ref_array('comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
    2942                         $cgroupby = apply_filters_ref_array('comment_feed_groupby', array( '', &$this ) );
     3328                        // duplicate_hook
     3329                        $cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
     3330
     3331                        // duplicate_hook
     3332                        $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
     3333
     3334                        // duplicate_hook
     3335                        $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
    29433336                        $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
    2944                         $corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
     3337
     3338                        // duplicate_hook
     3339                        $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
    29453340                        $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
    2946                         $climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
     3341
     3342                        // duplicate_hook
     3343                        $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
     3344
    29473345                        $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
    29483346                        $this->comments = $wpdb->get_results($comments_request);
    29493347                        $this->comment_count = count($this->comments);
     
    29783376                        }
    29793377
    29803378                        if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) )
     3379                                /**
     3380                                 * Filter the single post for preview mode.
     3381                                 *
     3382                                 * @since 2.7.0
     3383                                 *
     3384                                 * @param array $args {
     3385                                 *              The variables passed to the callback.
     3386                                 *
     3387                                 *              @type string   $post  The Post object.
     3388                                 *              @type WP_Query &$this The WP_Query object (passed by reference).
     3389                                 * }
     3390                                 */
    29813391                                $this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) );
    29823392                }
    29833393
     
    30233433                }
    30243434
    30253435                if ( !$q['suppress_filters'] )
    3026                         $this->posts = apply_filters_ref_array('the_posts', array( $this->posts, &$this ) );
     3436                        /**
     3437                         * Filter the array of retreived posts after they've been fetched and
     3438                         * internally processed.
     3439                         *
     3440                         * @since 1.5.2
     3441                         *
     3442                         * @param array $args {
     3443                         *              The variables passed to the callback.
     3444                         *
     3445                         *              @type string   $posts The array of retrieved posts.
     3446                         *              @type WP_Query &$this The WP_Query object (passed by reference).
     3447                         * }
     3448                         */
     3449                        $this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) );
    30273450
    30283451                // Ensure that any posts added/modified via one of the filters above are
    30293452                // of the type WP_Post and are filtered.
     
    30603483                        return;
    30613484
    30623485                if ( ! empty( $limits ) )
     3486                        /**
     3487                         * Filter the query to run for retrieving the found posts.
     3488                         *
     3489                         * @since 2.1.0
     3490                         *
     3491                         * @param array $args {
     3492                         *              The variables passed to the callback.
     3493                         *
     3494                         *              @type string   $query The query to run to find the found posts.
     3495                         *              @type WP_Query &$this The WP_Query object (passed by reference).
     3496                         * }
     3497                         */
    30633498                        $this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
    30643499                else
    30653500                        $this->found_posts = count( $this->posts );
    30663501
     3502                /**
     3503                 * Filter the number of found posts.
     3504                 *
     3505                 * @since 2.1.0
     3506                 *
     3507                 * @param array $args {
     3508                 *              The variables passed to the callback.
     3509                 *
     3510                 *              @type string   $found_posts The number of posts found.
     3511                 *              @type WP_Query &$this       The WP_Query object (passed by reference).
     3512                 * }
     3513                 */
    30673514                $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
    30683515
    30693516                if ( ! empty( $limits ) )
     
    31023549                $this->in_the_loop = true;
    31033550
    31043551                if ( $this->current_post == -1 ) // loop has just started
    3105                         do_action_ref_array('loop_start', array(&$this));
     3552                        /**
     3553                         * Fires actions to be run once the loop is started.
     3554                         *
     3555                         * @since 2.0.0
     3556                         *
     3557                         * @param array $args {
     3558                         *              The variables passed to the callback.
     3559                         *
     3560                         *              @type WP_Query &$this The WP_Query object (passed by reference).
     3561                         * }
     3562                         */
     3563                        do_action_ref_array( 'loop_start', array( &$this ) );
    31063564
    31073565                $post = $this->next_post();
    31083566                setup_postdata($post);
     
    31233581                if ( $this->current_post + 1 < $this->post_count ) {
    31243582                        return true;
    31253583                } elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
    3126                         do_action_ref_array('loop_end', array(&$this));
     3584                        /**
     3585                         * Fires actions to be run once the loop has ended.
     3586                         *
     3587                         * @since 2.0.0
     3588                         *
     3589                         * @param array $args {
     3590                         *              The variables passed to the callback.
     3591                         *
     3592                         *              @type WP_Query &$this The WP_Query object (passed by reference).
     3593                         * }
     3594                         */
     3595                        do_action_ref_array( 'loop_end', array( &$this ) );
    31273596                        // Do some cleaning up after the loop
    31283597                        $this->rewind_posts();
    31293598                }
     
    31743643                $comment = $this->next_comment();
    31753644
    31763645                if ( $this->current_comment == 0 ) {
    3177                         do_action('comment_loop_start');
     3646                        /**
     3647                         * Fires actions to be run once the comment loop is started.
     3648                         *
     3649                         * @since 2.2.0
     3650                         */
     3651                        do_action( 'comment_loop_start' );
    31783652                }
    31793653        }
    31803654
     
    39354409                $pages = array( $post->post_content );
    39364410        }
    39374411
    3938         do_action_ref_array('the_post', array(&$post));
     4412        /**
     4413         * Fires actions to be run once the post data has been setup.
     4414         *
     4415         * @since 2.8.0
     4416         *
     4417         * @param array $args {
     4418         *              The variables passed to the callback.
     4419         *
     4420         *              @type WP_Post &$post The Post object (passed by reference).
     4421         * }
     4422         */
     4423        do_action_ref_array( 'the_post', array( &$post ) );
    39394424
    39404425        return true;
    39414426}