If you change your `if` statement to use `$query->is_main_query()` like the example on the [`is_main_query()` codex page][1], does that resolve the issue? The nav menus are created by a query, so usually this problem stems from the `pre_get_posts` interfering with the menus query. Hence, I wonder whether that check isn't working. [1]: http://codex.wordpress.org/Function_Reference/is_main_query