WP_Query is tool provided by the WordPress Core to facilitate the search and retrieval of posts, pages, and CPT data from the database. This class provides a number of hooks that theme and plugin authors can use to alter the results returned. One of those hooks is pre_get_posts. This hook runs just before posts are retrieved from the database, making it extremely useful and versatile.

history | show excerpt | excerpt history