WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/posts selection

This page is marked as incomplete. You can help Codex by expanding it.

Description

This action hook is executed prior to the query, and is passed a string containing the assembled query. Note that this string is NOT passed by reference and manipulating this string will not affect the actual query. This is intended to be used primarily by caching plugins.

Example Usage

add_action( 'posts_selection', 'check_assembled_query' );

function check_assembled_query( $query ) {
    var_dump( $query );
}

Source File

The 'posts_selection' hook is found in /wp-includes/query.php, within the get_posts() method of the WP_Query() class.

Related