You don’t need to call wp_reset_query()
here, because you’re not modifying the main query. Instead, call wp_reset_postdata()
.
You only need to call wp_reset_query()
when modifying the main loop via query_posts()
(which you shouldn’t do, anyway, so you should never need to call wp_reset_query()
).
But new WP_Query()
, with a properly instantiated loop – i.e. one that calls the_post()
– will stomp on the $post
data for the main query. So, after closing your custom WP_Query()
loop, call wp_reset_postdata()
to restore $post
data to the main query.