When I create a WP_Query
it's automatically considered a "secondary query", but what if I replace my main query with a WP_Query? Can I set my WP_Query to be considered a "Main Query"?
The reason I say this is because I need to use pre_get_posts
to do some filtering. My current logic looks like this:
if(isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'my_post_type')
The problem with the above logic is that I have 2 queries in the same template of the same post type but only one of them is my core query, the query I want to label as "Main Query" so I can use a conditional such as $query->is_main_query()
to differentiate the two and filter accordingly.