Open Menu Links in New Tabs

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 open links in a new browser window using the setAttribute method.

For example, if you are using an external system to control your knowledge base, you could use the following code:

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) {
    $navItem = $primaryNavbar->getChild('Knowledgebase');
    if (is_null($navItem)) {
        return;
    }
    $navItem->setUri('https://www.example.com/3rdpartyknowledgebasesystem');
    $navItem->setAttribute("target", '_blank');
});

Last modified: June 14, 2024