Main query disturb pre_get_post by category query
Use the different variable names on the place of $posts. You should not use any of the global variable names for avoiding such incidents. Also, call wp_reset_query() after fetching your data. This will reset the query to default. For the list of global variables please refer to this link. Edit your query to read like … Read more