Change a Menu Item Label

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.

Changing the Text Label of a Menu Item

Language files control all of the default menu items. Search in your active language file for the text you see in the menu item label. You can adjust it in this file to change the displayed label, or you can use a hook:

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) {
    $navItem = $primaryNavbar->getChild('Support');
    if (is_null($navItem)) {
        return;
    }

    $navItem = $navItem->getChild('Announcements');
    if (is_null($navItem)) {
        return;
    }

    $navItem->setLabel('Custom Title Here');
});

The example above retrieves the Support menu item and Announcements child menu item.

Last modified: September 23, 2024