Welcome, visitor! Log in
 

WordPress hook directory
pre_get_posts

Description

Runs before a query is executed in the main query or any instance of WP_Query, such as query_posts, get_posts, or get_children. Action function arguments: WP_Query object by reference.

This description was scraped automatically from the WordPress filter reference or action reference. If it looks like this is the wrong description, please tell me so I can fix my code.

WordPress version history for pre_get_posts

This database has information for all major versions from WP 1.2.1 through 3.5.

Version File Line Type
2.0 wp-includes/classes.php 262 View hook in source action
2.0.11 wp-includes/classes.php 272 View hook in source action
2.1 wp-includes/query.php 573 View hook in source action
2.2 wp-includes/query.php 643 View hook in source action
2.3 wp-includes/query.php 733 View hook in source action
2.5 wp-includes/query.php 811 View hook in source action
2.6 wp-includes/query.php 815 View hook in source action
2.7 wp-includes/query.php 1565 View hook in source action
2.8 wp-includes/query.php 1567 View hook in source action
2.9 wp-includes/query.php 1549 View hook in source action
3.0 wp-includes/query.php 1611 View hook in source action
3.1 wp-includes/query.php 1877 View hook in source action
3.2 wp-includes/query.php 1911 View hook in source action
3.3 wp-includes/query.php 1923 View hook in source action
3.4 wp-includes/query.php 1922 View hook in source action
3.5 wp-includes/query.php 1924 View hook in source action

Related Hooks

We find related hooks using word stems. pre_get_posts has 1 significant word stem(s): posts. Note that some of the hooks below may not appear in all versions of WP.