WHMCS supports two documented ways to add a custom page. The first is a standalone PHP file in the WHMCS root directory that uses the ClientArea class plus your own template file. The second, which the developer documentation recommends, is an addon module with a _clientarea function. Both survive an update, because neither one edits a file that WHMCS ships.
A WHMCS custom page is a client area page you add yourself, next to the pages WHMCS already provides. It has two parts: PHP that loads the data and sets the page title, breadcrumb and template, and a Smarty template file that draws the output. Nothing in either part replaces a WHMCS file, which is the whole reason an update leaves it alone.
Everything below is checked against the WHMCS developer documentation and the WHMCS 9.1 user documentation, read on 1 December 2026. The WHMCS documentation home page lists 9.1 as the General Availability release, with 9.0 and 8.13 on Long-Term Support. The developer pages are not split by version, so the same code is published for current releases.

Which custom page method should you choose?
Start with the addon module, because that is what WHMCS tells you to do. The Creating Pages page opens by saying that creating your own client area pages should ordinarily be done by creating an addon module with client area output, and then offers the standalone root file as a template for people who still want it.
In practice the choice comes down to who installs the page and whether it needs settings of its own.
| Question | Root PHP file | Addon module |
|---|---|---|
| Where the code lives | The WHMCS root directory, next to index.php | /modules/addons/your_module_name/your_module_name.php |
| Where the template lives | The active system theme folder | The module folder |
| Page URL | /mypage.php | index.php?m=modulename |
| Requiring a login | $ca->requireLogin() | 'requirelogin' => true in the return array |
| Admin settings screen | None. You hard code or write your own | Config fields at Configuration > System Settings > Addon Modules |
| Installing it somewhere else | Copy two files by hand into the right folders | Drop in one folder, then activate it |
| Follows a theme change | No. The template sits in one theme folder | Yes. The template travels with the module |

In words: static marketing copy with no client data on it belongs on your main website. If other installs will have to install the page, or it needs an admin settings screen, write an addon module. One page on one install is the case where the root PHP file is the smaller job.
How do you build a custom page as a root PHP file?
You create one PHP file in the WHMCS root directory and one template file in the active theme. The PHP file loads WHMCS through init.php, builds a ClientArea object, assigns the variables the page needs, names a template and calls output(). This is a trimmed version of the documented template:
<?php
use WHMCS\Authentication\CurrentUser;
use WHMCS\ClientArea;
define('CLIENTAREA', true);
require __DIR__ . '/init.php';
$ca = new ClientArea();
$ca->setPageTitle('Server Status');
$ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname'));
$ca->addToBreadCrumb('mypage.php', 'Server Status');
$ca->initPage();
//$ca->requireLogin(); // Uncomment this line to require a login to access this page
$currentUser = new CurrentUser();
$authUser = $currentUser->user();
if ($authUser) {
$ca->assign('userFullname', $authUser->fullName);
$selectedClient = $currentUser->client();
} else {
$ca->assign('userFullname', 'Guest');
}
Menu::primarySidebar('announcementList');
$ca->setTemplate('mypage');
$ca->output();

Five calls do most of the work, and each one has a direct equivalent in the addon module method.
| Call | What it does |
|---|---|
define('CLIENTAREA', true) and require __DIR__ . '/init.php' | Loads WHMCS and marks the request as a client area request. This is why the file has to sit in the root directory. |
$ca->setPageTitle() and $ca->addToBreadCrumb() | Sets the browser title and the breadcrumb trail. Lang::trans() pulls a string from the active language file. |
$ca->requireLogin() | Blocks the page for visitors who are not signed in. It ships commented out, so a new page is public until you uncomment it. |
$ca->assign('name', $value) | Passes a variable to the template, where it is read as {$name}. |
$ca->setTemplate('mypage') and $ca->output() | Names the template file without its .tpl extension and renders the page. |
The CurrentUser helper shown above reads both the signed-in user and the client account they have selected, which matters where one user manages several accounts.
How do you build the same page as an addon module?
You create a module folder, a config function and a _clientarea function that returns an array. Getting Started sets the naming rules: unique, all lowercase, letters and numbers only, starting with a letter, with the underscore as the only accepted special character. The folder goes in /modules/addons/ and the core file inside it matches the folder name.
modules/addons/serverstatus/
serverstatus.php the _config and _clientarea functions
clienthome.tpl the template this module renders
hooks.php optional, loaded on every page
lang/
english.php optional language strings
The Client Area Output page gives the function. It returns a page title, a breadcrumb, a template file name, a login requirement and the variables for the template:
function serverstatus_clientarea($vars)
{
$modulelink = $vars['modulelink'];
$LANG = $vars['_lang'];
return array(
'pagetitle' => 'Server Status',
'breadcrumb' => array('index.php?m=serverstatus' => 'Server Status'),
'templatefile' => 'clienthome',
'requirelogin' => true, // accepts true/false
'forcessl' => false, // accepts true/false
'vars' => array(
'lastChecked' => date('c'),
),
);
}
Clients reach it at index.php?m=modulename, and the template named in templatefile lives inside the module folder. Settings come from the config function on the Configuration page, which supports text, password, yesno, textarea, dropdown and radio fields. They arrive in $vars as option1 through option6, so an API key or hostname is edited by an admin rather than typed into the file.

The repository is public, carries an MIT license and already uses the modules/addons/addonmodule layout, so renaming its folder and file beats starting from an empty directory. My guide to WHMCS module types places addon modules next to provisioning and gateway modules.
Where does the template file for a custom page go?
For a root PHP file it goes in the active system theme folder, and for an addon module it goes in the module folder. The documentation for the standalone method gives the path as /templates/default/mypage.tpl for a template named mypage, which means the folder of whichever theme is live.
That is the part people get wrong, because of how child themes work. A child theme holds only the files you changed and inherits the rest, and any file you add to it overrides the parent's copy. A brand new template that exists nowhere in the parent can therefore live in the child theme folder on its own. Put it there, not in twenty-one or six, which an update overwrites.
- Child theme, new file.
/templates/mytheme/mypage.tpl. Nothing to inherit, nothing to merge at update time. - Module template.
/modules/addons/serverstatus/clienthome.tpl. Moves with the module and keeps working if you change system theme. - Preview before you switch. The
?systpl=xxxxURL parameter renders the client area in another theme without changing the live setting.
If you have not set up a child theme yet, do that first. My WHMCS theme structure guide covers theme.yaml, parents and the folder layout.
How do you link the new page into the client area navigation?
With a hook, never by editing navbar.tpl. The Navigation page says the navigation bar elements are controlled programmatically so modules and hooks can change the menu, and gives the code for adding an item:
<?php
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) {
$primaryNavbar->addChild('Server Status')
->setUri('mypage.php')
->setOrder(70);
});
Hook files go in /includes/hooks/, as the hooks Getting Started page describes, and a file whose name starts with an underscore is skipped, which is a clean way to disable one while testing. Inside an addon module the same functions go in a hooks.php file, which WHMCS loads on every page.
Four details save time here. Menu items form a tree, so a child item needs getChild('Support')->addChild(...) with a null check on the parent, because a parent that has been removed returns null and a missing check takes the client area down. Ordering uses setOrder(), with moveUp(), moveDown(), moveToFront() and moveToBack() as helpers. To show the link only to signed-out visitors, read Menu::context('client') and branch on whether it is null. For the sidebar the hook point is ClientAreaPrimarySidebar. My WHMCS hooks guide covers hook points and priorities.
What URL will the custom page have?
A root PHP file keeps its own file name, and the documented address for an addon module page is the query string index.php?m=modulename. The Friendly URLs setting on the General tab at Configuration > System Settings > General Settings decides how WHMCS writes its own links, in three documented modes.
| Friendly URLs mode | Documented example | Your root PHP page |
|---|---|---|
| Full Friendly Rewrite | http://example.com/knowledgebase | http://example.com/mypage.php |
| Friendly index.php | http://example.com/index.php/knowledgebase | http://example.com/mypage.php |
| Basic URLs | http://example.com/index.php?rp=/knowledgebase | http://example.com/mypage.php |
The reason the file name keeps working is in the rewrite rules WHMCS publishes on that same settings page. The managed block routes a request to index.php only after two conditions, RewriteCond %{REQUEST_FILENAME} !-f and !-d, so a request that matches a real file on disk is served directly. Your mypage.php is a real file, so it never reaches the router.
Two warnings come with that. The managed rules sit between comment markers that read BEGIN - WHMCS managed rules - DO NOT EDIT BETWEEN WHMCS MARKERS, and the documentation says any custom rules of your own belong before or after those markers. And if the page returns 404 rather than your template, read the 404 Page Not Found Errors page: the documented causes are a friendly URL mode the server cannot support and an out of date .htaccess, and the documented fixes are switching to Basic URLs, or opening Advanced Settings, checking the Rewrite File tab for an OUT OF SYNC message and clicking Synchronize.
What survives a WHMCS update, and what does not?
Everything in this guide survives, as long as you did not edit a shipped file. The Updating WHMCS page lists what an update overwrites: the language files, the default templates in templates/twenty-one, templates/six and templates/orderforms, the WHMCS-supplied modules and the core files. It also says to keep a uniquely named copy of any module you customize. Your own root PHP file, module folder, child theme folder and hook files are not on that list.
- The custom page is a new file in the root directory, not a modified WHMCS file.
- The module folder is yours, under
/modules/addons/. - The template is in your child theme or module folder, never inside
twenty-one,nexusorsix. - The menu link is a hook, not an edited
navbar.tpl. - Auto-Managed Rewrite is on, so a WHMCS update can refresh the
.htaccessrules between its own markers. - Your own rewrite rules, if any, sit outside those markers.
- You previewed the page with
?systpl=before changing the live system theme. - You tested the page on a staging copy after the update, signed out as well as signed in.
Two things still need attention after a major upgrade. Theme markup differs between system themes, so a template written against Twenty-One markup can look wrong under Nexus even though the file is untouched. A class or helper you called can also be deprecated, which is why I run custom pages through a staging copy at every major version step. My WHMCS 9 upgrade guide covers the upgrade itself.
When should you not add a custom page to WHMCS?
When the page has nothing to do with billing or client data. A pricing page, an about page or a blog post belongs on your main website, which is faster to edit and does not load the whole WHMCS stack on every request.
- Public pages that query the database. A root PHP page without
requireLogin()is reachable by anyone who finds the URL, so any query there is effectively public. - Pages that accept input. Forms, uploads and anything writing to the database need validation and prepared statements of your own.
- Encoded modules. A commercial module that is ionCube encoded cannot be edited to add a page. You add a second module instead.
- Admin area screens. A client area page is not an admin page. Addon modules have a separate documented admin output function for that.
- Work you would rather not maintain. Two small pages are fine. Fifteen undocumented ones are a project.
What else do people ask about WHMCS custom pages?
Where exactly does the PHP file have to live?
In the root WHMCS directory, the folder that holds init.php and index.php. The documentation says custom pages created this way should always be located there and that using the code elsewhere is unsupported, because require __DIR__ . '/init.php' resolves relative to the file. An addon module page has no such restriction.
How do I make a custom WHMCS page require a login?
Uncomment $ca->requireLogin(); in the root PHP file, or set 'requirelogin' => true in the array an addon module returns. In the shipped example that line is commented out, so a page you copy without changing it is public. Check it signed out in a private browser window rather than trusting the code.
Why does my custom WHMCS page return a 404?
Usually the file is not where you think it is, or the server's friendly URL rules are out of sync. Confirm the file is in the WHMCS root and that the template name you passed to setTemplate() matches a .tpl file in the active theme. If other WHMCS pages 404 as well, the problem is the rewrite rules, and the documented route is switching Friendly URLs to Basic URLs or clicking Synchronize on the Rewrite File tab.
Can one addon module serve more than one page?
Yes. The documented URL format is index.php?m=modulename, and _clientarea is ordinary PHP, so it can read extra query parameters and return a different templatefile for each. The documentation shows only the single URL format, so treat the routing inside the function as your own code to test.
Can I add a custom page to the WHMCS admin area too?
Yes, through an addon module. The Addon Modules section of the developer documentation has a separate Admin Area Content/Output page for that, alongside admin dashboard widgets. The root PHP file method described here is specific to the client area, because it defines the CLIENTAREA constant before loading WHMCS.
If you want a custom client area page built, linked and handed over with the code documented, that is custom WHMCS module development or WHMCS theme customization work, at $55 to $65 per hour or as a fixed quote, with a free scoping call of about 30 minutes and a written quote within one business day.
Last reviewed 1 December 2026. Disclosure: I sell WHMCS and web development work, so I am not neutral. I am CTO at ElySpace, a freelance developer for Marmaids LLC, and founder of WHMCSPilot and MagizAI. The code, file paths, function names, settings and rewrite rules above come from the WHMCS developer documentation and the WHMCS 9.1 documentation as I read them on that date.