Magento 2 – How to Remove an Existing Menu Item

adminadminmenubackendmagento-2.0magento2

How to remove an existing menu item (not declared by my module) using my module's menu.xml?

Best Answer

Let's say the menu item you want to remove is declared like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Vendor_Module::test" title="Test" module="Vendor_Module" sortOrder="100" parent="Magento_Backend::content" resource="Vendor_Module::test" />
    </menu>
</config>

You can do the following in your menu.xml to remove that menu item:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <remove id="Vendor_Module::test" />
    </menu>
</config>
Related Topic