Change a Menu Item Link

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.

You can change where a menu item points to using the setUri method. For example, if you use an external system to control announcements, you could use the following example:

<?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->setUri('https://www.example.com/3rdpartyblogsystem');
});

Last modified: October 29, 2024