posts_request filter-hookWP 2.0.0

Filters the completed SQL query before sending.

Usage

add_filter( 'posts_request', 'wp_kama_posts_request_filter', 10, 2 );

/**
 * Function for `posts_request` filter-hook.
 * 
 * @param string   $request The complete SQL query.
 * @param WP_Query $query   The WP_Query instance (passed by reference).
 *
 * @return string
 */
function wp_kama_posts_request_filter( $request, $query ){

	// filter...
	return $request;
}
$request(string)
The complete SQL query.
$query(WP_Query)
The WP_Query instance (passed by reference).

Changelog

Since 2.0.0 Introduced.

Where the hook is called

WP_Query::get_posts()
posts_request
wp-includes/class-wp-query.php 3036
$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );

Where the hook is used in WordPress

Usage not found.