Adding meta_key via pre_get_posts causes navigation to disappear

If you change your if statement to use $query->is_main_query() like the example on the is_main_query() codex page, 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.

Leave a Comment