What happens to the default query when I use WP_Query?

Question

I’m working on a custom theme based on Underscores. In my archive.php I want to style the first post in the loop differently than the rest, so I’m running one WP_Query to fetch the first post, and another to get the remaining posts.

What I’m wondering is — since I’m handling the queries myself, what happens to the default query that WordPress is running implicitly (that is, the one I’d normally be iterating over with while ( havePosts() )? Obviously for performance reasons I don’t want to run any unnecessary queries, so is there a way I can stop it?

I’m somewhat familiar with the pre_get_posts hook, but I’m not sure how I would use it since, as I mentioned, I’m not just trying to modify the one default query — I need two (unless there’s a better way of doing this).

0
, Rob 4 years 2020-03-25T04:50:56-05:00 0 Answers 98 views 0

Leave an answer

Browse
Browse