How to Remove Link from a Menu Item in WordPress


This is a nice little WordPress fix. I often get asked by clients whether menu links that house sub-menus should be a page in themselves, or merely a ‘hover’ link that reveals the drop-down menu underneath. In truth, the answer is dependent upon the nature of your website and the content you have for it, but more often than not it makes sense to eliminate the page itself, and simply use it to reveal the sub-menu. If you’re not sure what I mean, try hovering over the ‘digital marketing’ link in our website’s main menu – you’ll see the sub-menu automatically appear, but the ‘digital marketing’ link itself doesn’t actually do anything. What’s more, it doesn’t show the standard ‘pointer’ icon that other web links do, so it’s clear to the end-user that this can’t be clicked – that’s actually pretty important from a user-experience point of view. The last thing you want is confused visitors repeatedly clicking something that doesn’t actually link anywhere.

So how is this possible? It’s actually pretty simple, and involves just a couple of steps. The first thing you need to do is create a menu item to house the sub-menu links. To do this, login to your WordPress admin and then hover over ‘Appearance’ and click ‘Menus’. Choose the relevant menu, and then on the left click ‘Custom Links’. In here, enter the hash symbol (#) as the URL – there’s no need to use the http:// preface, so just remove that. In the ‘Link Text’ box, just add whatever title you want for the menu item. When you’re done, click ‘Add to Menu’ and drag the new item into place, then drag and drop your chosen sub-menu pages underneath your new link so they appear as sub-menu items. Click ‘Save Menu’.

That’s the first bit done. However, you’ll notice that your new menu item, despite the fact that the link doesn’t work, still shows up in the browser as a link, even though it doesn’t link anywhere. To fix this, we wrote a little plugin (it’s free!) called “Remove Pointer from Blank Menu Items”. All you need to do is install this, either by searching for it via your WordPress admin (click Plugins -> Add New and then search there) or by downloading it from the WordPress plugin repository page here. Once installed, just click ‘Activate’ and you’re done! Your shiny new menu item is just plain old text that reveals the sub-menu upon hover.