By default, the WordPress menu is made of links to static pages. Sometimes though you want to tweak it and add categories or external links. Or even make a sub-menu without the parent item being a link at all. Here’s how.
When you first install WordPress, a navigation menu is automatically generated using pages in an arbitrary order.
While building your site and organizing your content, you will want to take control over this menu to change the order, remove some pages, add new links or organize all links in sub-menus etc.
You can do all of this in Appearance > Menus.
Getting started: build your custom menu in WordPress
From Appearance > Menus, click “create a new menu”, give it a name and click “Save Menu” and you are ready to build your own custom menu structure.
Now you can start building your menu by taking items from the left columns. Usually you will start by adding Pages, but note that other elements like Custom Links and Categories are available.
Once you have added items to the menu structure, you can re-order them easily with drag-and-drop.
Sometimes just ordering items is not enough, and you want to organize them into sub-menus.
To make an item a child of another, place it below the “parent” and simply drag and drop it slightly to the right.
You can of course add as many items in a sub-menu as you wish, and even create sub-sub-menus up to 10 levels (although this is not recommended for the sake of user-experience!)
Now what if you want to create a sub-menu, without the parent being a link ? If you look at the example image above, “Level 1” is actually a page.
Sometimes however you don’t want to create a page for this, and you don’t want your visitors to be able to click it: you just want this item to open a sub-menu without being a link itself.
At first it seems like WordPress doesn’t offer this possibility, but actually there is a way to do this. For some reason the process is a bit convoluted and not intuitive, but it is pretty easy once you know how to do it.
First, from the left column, open the Custom Links pane instead of Pages. Create your parent link, and just enter “#” instead of an URL (you can also enter anything as URL, the next step will be to remove it anyway).
WordPress won’t let you add this item to the menu unless you fill the URL field, this is why you cannot leave it empty at this point.
Next, click Add to menu and click the small arrow on the right of this new item in the menu structure to reveal some options. Now you can empty the URL field.
Then re-organize your menu to use this item as a parent, and there you have your sub-menu with an un-linked (and unclickable) parent!
The image below which hopefully makes it more clear:
Don’t forget to check the appropriate Theme location under Menu Settings to tell WordPress where to use this menu. Note that you can also change this setting in the Manage Locations tab.
And of course, make sure to click “Save menu” when you are done!