Fires after the query variable object is created, but before the actual query is run.
$queryWP_Querywp-includes/class-wp-query.php:1906WP_Query::get_posts() * like `is_main_query()` test against the global `$wp_query` instance, not the passed one. * * @since 2.0.0 * * @param WP_Query $query The WP_Query instance (passed by reference). */ do_action_ref_array( 'pre_get_posts', array( &$this ) ); // Locally scoped reference for easy of use. $query_vars = &$this->query_vars; // Fill again in case 'pre_get_posts' unset some vars. $query_vars = $this->fill_query_vars( $query_vars );Introduced in 2.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.