I was having the exact same problem on an archive page of a custom post type with a needless extra query; for pagination reasons. Searching for the same solution I found this post on Stack Overflow https://stackoverflow.com/questions/21303743/new-wp-query-or-pre-get-posts-to-view-all-posts-for-custom-post-type
I had a play and added this line of code into the function.
if( ! $query->is_post_type_archive()) return;
So my final code looks like this. I tested this and it doesn’t seem to affect any other pages in any way and fixes the problem for me.
add_action('pre_get_posts', 'my_pre_get_posts');
function my_pre_get_posts( $query )
{
// validate
if( is_admin() )
{
return $query;
}
if( ! $query->is_post_type_archive() ) return;
// allow the url to alter the query
if( isset($_GET['status']) )
{
$query->set('meta_key', 'status');
$query->set('meta_value', $_GET['status']);
}
// always return
return $query;
}