posts_clauses_request
Filters all query clauses at once, for convenience.
Description
For use by caching plugins.
Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT, fields (SELECT), and LIMITS clauses.
Parameters (1)
- 0. $array (array) =>
array( compact( $pieces ), &$this )
- The array.
Usage
- To run the hook, copy the example below.
- $array = apply_filters( 'posts_clauses_request', $array );
- if ( !empty( $array ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the posts_clauses_request callback
- function filter_posts_clauses_request( $array ) {
- // make filter magic happen here...
- return $array;
- };
- // add the filter
- add_filter( 'posts_clauses_request', 'filter_posts_clauses_request', 10, 1 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'posts_clauses_request', 'filter_posts_clauses_request', 10, 1 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/class-wp-query.php
- $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );