The Wordpress main menu item appears out of nowhere for the mobile version


I've been asked to look at the main menu on, This is a Wordpress website, it has full and mobile version and the menu is different for both. For full version the menu works well and shows all the items as per Wordpress Dashboard>>Appearance>>Menu. For the mobile version however the menu adds a "- MENU -" item to the menu (to the very top). I've been asked to remove this item.

From what I see the menu is generated in header.php with this single line -

<?php wp_nav_menu( array( 'menu_id'=>'nav', 'theme_location'=>'main-navigation')); ?>

Initially I thought that I can remove a single item by using exclude, as per this example - wp_nav_menu exclude pages from menu

However, the "- MENU -" item does not have a page ID.


The reason that's happening is that Javascript is building the menu based on the main menu. Look at the selectnav.js file:


Look into that file and you can see label = o.label || "- MENU -",

You'll have to know some JS to fix this issue.