pre_get_posts and set

pre_get_posts triggers for every query (front and admin side). It also triggers when querying nav-menu items (which is what is happening here).

Most of the time you only want to filter particular queries – so you need to check if that query is one you wish to modify.

Usually – and I think your example might be one – you only want to modify the ‘main query’.

function wpse72969_pre_get_posts( $query) {
    //If its not the 'main query' don't do antying.
    if( !$query->is_main_query() )
        return;

    return $query; 
}
add_action('pre_get_posts', 'wpse72969_pre_get_posts');

More generally all the conditionals are available to you (Note: you want want to use the methods and not the functions: e.g. $query->is_search() as opposed to is_search().

You can even set custom variables to identify queries.