Make WordPress Core


Ignore:
Timestamp:
02/20/2014 05:40:14 PM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for various SQL clause hooks in wp-includes/query.php.

Covers documentation for SQL clause hooks specified for use by caching plugins, including:

  • posts_selection
  • posts_where_request
  • posts_groupby_request
  • posts_join_request
  • posts_orderby_request
  • posts_distinct_request
  • posts_fields_request
  • post_limits_request
  • posts_clauses_request

Props dougwollison, DrewAPicture.
See #25514.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r27206 r27207  
    29732973        }
    29742974
    2975         // Announce current selection parameters. For use by caching plugins.
     2975        /**
     2976         * Fires to announce the query's current selection parameters.
     2977         *
     2978         * For use by caching plugins.
     2979         *
     2980         * @since 2.3.0
     2981         *
     2982         * @param string $selection The assembled selection query.
     2983         */
    29762984        do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
    29772985
    2978         // Filter again for the benefit of caching plugins. Regular plugins should use the hooks above.
     2986        /*
     2987         * Filter again for the benefit of caching plugins.
     2988         * Regular plugins should use the hooks above.
     2989         */
    29792990        if ( !$q['suppress_filters'] ) {
     2991            /**
     2992             * Filter the WHERE clause of the query.
     2993             *
     2994             * For use by caching plugins.
     2995             *
     2996             * @since 2.5.0
     2997             *
     2998             * @param string   $where The WHERE clause of the query.
     2999             * @param WP_Query &$this The WP_Query instance (passed by reference).
     3000             */
    29803001            $where      = apply_filters_ref_array( 'posts_where_request',       array( $where, &$this ) );
     3002
     3003            /**
     3004             * Filter the GROUP BY clause of the query.
     3005             *
     3006             * For use by caching plugins.
     3007             *
     3008             * @since 2.5.0
     3009             *
     3010             * @param string   $groupby The GROUP BY clause of the query.
     3011             * @param WP_Query &$this   The WP_Query instance (passed by reference).
     3012             */
    29813013            $groupby    = apply_filters_ref_array( 'posts_groupby_request',     array( $groupby, &$this ) );
     3014
     3015            /**
     3016             * Filter the JOIN clause of the query.
     3017             *
     3018             * For use by caching plugins.
     3019             *
     3020             * @since 2.5.0
     3021             *
     3022             * @param string   $join  The JOIN clause of the query.
     3023             * @param WP_Query &$this The WP_Query instance (passed by reference).
     3024             */
    29823025            $join       = apply_filters_ref_array( 'posts_join_request',        array( $join, &$this ) );
     3026
     3027            /**
     3028             * Filter the ORDER BY clause of the query.
     3029             *
     3030             * For use by caching plugins.
     3031             *
     3032             * @since 2.5.0
     3033             *
     3034             * @param string   $orderby The ORDER BY clause of the query.
     3035             * @param WP_Query &$this   The WP_Query instance (passed by reference).
     3036             */
    29833037            $orderby    = apply_filters_ref_array( 'posts_orderby_request',     array( $orderby, &$this ) );
     3038
     3039            /**
     3040             * Filter the DISTINCT clause of the query.
     3041             *
     3042             * For use by caching plugins.
     3043             *
     3044             * @since 2.5.0
     3045             *
     3046             * @param string   $distinct The DISTINCT clause of the query.
     3047             * @param WP_Query &$this    The WP_Query instance (passed by reference).
     3048             */
    29843049            $distinct   = apply_filters_ref_array( 'posts_distinct_request',    array( $distinct, &$this ) );
     3050
     3051            /**
     3052             * Filter the SELECT clause of the query.
     3053             *
     3054             * For use by caching plugins.
     3055             *
     3056             * @since 2.5.0
     3057             *
     3058             * @param string   $fields The SELECT clause of the query.
     3059             * @param WP_Query &$this  The WP_Query instance (passed by reference).
     3060             */
    29853061            $fields     = apply_filters_ref_array( 'posts_fields_request',      array( $fields, &$this ) );
     3062
     3063            /**
     3064             * Filter the LIMIT clause of the query.
     3065             *
     3066             * For use by caching plugins.
     3067             *
     3068             * @since 2.5.0
     3069             *
     3070             * @param string   $limits The LIMIT clause of the query.
     3071             * @param WP_Query &$this  The WP_Query instance (passed by reference).
     3072             */
    29863073            $limits     = apply_filters_ref_array( 'post_limits_request',       array( $limits, &$this ) );
    29873074
    2988             // Filter all clauses at once, for convenience
     3075            /**
     3076             * Filter all query clauses at once, for convenience.
     3077             *
     3078             * For use by caching plugins.
     3079             *
     3080             * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
     3081             * fields (SELECT), and LIMITS clauses.
     3082             *
     3083             * @since 3.1.0
     3084             *
     3085             * @param array    $pieces The pieces of the query.
     3086             * @param WP_Query &$this  The WP_Query instance (passed by reference).
     3087             */
    29893088            $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
    29903089            foreach ( $pieces as $piece )
Note: See TracChangeset for help on using the changeset viewer.