Disable a menu Item

I tried to disable a menu item in the menu so only the sub items are clickable I chose the setting and saved but its still clickable, Why will it not turn off and become un-clickable?

Hi @rotation,

The fastest way is using with the custom CSS.

Please assign the disable-link CSS class to the CSS Classes (optional) field your menu item:

Then add the following CSS under Theme Options > CSS:

.disable-link {
  pointer-events: none;
  cursor: default;
}

There is a Javascript solution as well, you can take a look at this:

Hope it helps :slight_smile:

Where do I find this section

Hi @rotation,

It’s under Appearance > Menus

Thanks

ok that did not work I tried the css - nothing happened - and I have a drop down for the menu item I want to turn it off only so its not clickable. I want to turn off just portfolio not the whole menu below it.

Hey @rotation,

It does not work because of the wrong CSS code. We’re sorry about that. Here’s the correct one:

.disable-link > a {
  pointer-events: none;
  cursor: default;
}

The addition of the disable-link class to the menu item still applies and is essential for this to work.

Hope that helps.

I did put the code and added disable-link) see screen shots. I know before all I had to do was turn off from menu and the drop down would work, but seems not any more, now that I added the css and disable link, the whole drop down did not work. if I wanted the whole link and drop down disabled i would delete from menu , how can we do what im trying to do?

Hello @rotation,

I have inspected your site and disable-link was not added to the menu item. Please edit your menu and make sure to add the class. If nothing is helping, please provide us access to your site so that we can investigate. You can always add the WP credentials in a secure note in your next reply. To know how to create a secure note, please check this out: https://theme.co/apex/forum/t/how-to-get-support/288

Best Regards.

ok ill add the code back in and let you see the backend

Hi @rotation,

You have added it with typo error

Please correct the typo error and it should work.

Thanks!

yeah the whole drop down is disabled - thats not what im trying to do can you see the url - how can I shut off only the portfolio link? this should be simple

Hi @rotation,

In that case, you don’t need to actually add your page as menu item. Just add a custom menu item with # as URL. Example

That’s how it should be done :slight_smile:

Thanks!

THIS is crazy how many messages it takes to do what I asked in the first post. Im just completely surprised at the amount of time spent to disable a link. Thanks anyway but the mystery is not solved.

Hi @rotation,

Perhaps there is a confusion for the terms used, would you mind providing more information of what you mean by disabling menu item is?

Please note that implementing disable-link will disable it entirely, as you said so. So to make it work again, you shouldn’t implement it, instead implement the procedure I provided. And it appears you still implemented disable-link even though you don’t prefer that one. But sorry for the confusion, I should make it more clear. Please remove disable-link from the new added custom menu :slight_smile:

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.