Remove a Menu Item

You can customize the Client Area’s navigation menus through hooks and custom modules.

For more information about customizing the Client Area’s navigation menus, see Client Area Navigation Menus and our Developer Documentation.

Remove a Menu Item

You can remove a menu item using the following example code:

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) {
    if (!is_null($primaryNavbar->getChild('Network Status'))) {
        $primaryNavbar->removeChild('Network Status');
    }
});

Remove a Child Menu Item

You can remove a child menu item using the following example code:

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) {
    if (!is_null($primaryNavbar->getChild('Support'))) {
        $primaryNavbar->getChild('Support')->removeChild('Announcements');
    }
});

Last modified: May 31, 2024