posts_results filter-hookWP 2.3.0

Filters the raw post results array, prior to status checks.

Usage

add_filter( 'posts_results', 'wp_kama_posts_results_filter', 10, 2 );

/**
 * Function for `posts_results` filter-hook.
 * 
 * @param WP_Post[] $posts Array of post objects.
 * @param WP_Query  $query The WP_Query instance (passed by reference).
 *
 * @return WP_Post[]
 */
function wp_kama_posts_results_filter( $posts, $query ){

	// filter...
	return $posts;
}
$posts(WP_Post[])
Array of post objects.
$query(WP_Query)
The WP_Query instance (passed by reference).

Changelog

Since 2.3.0 Introduced.

Where the hook is called

WP_Query::get_posts()
posts_results
wp-includes/class-wp-query.php 3159
$this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) );

Where the hook is used in WordPress

Usage not found.