Filters the completed SQL query before sending.
Parameters
Source
$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
| CARVIEW |
Filters the completed SQL query before sending.
The input of this filter is the post request SQL, something like the following:
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_posts AS p2 ON ( wp_posts.post_parent = p2.ID ) WHERE 1=1 AND wp_posts.ID IN ( 3, 632 ) AND wp_posts.post_type != 'revision' AND ( ( wp_posts.post_status = 'publish' ) OR ( wp_posts.post_status = 'inherit' AND ( p2.post_status = 'publish' ) ) ) ORDER BY wp_posts.post_date DESC LIMIT 0, 20
$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
| Used by | Description |
|---|---|
WP_Query::get_posts()wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.