How to Add a Custom WordPress Admin Page (add_menu_page Boilerplate)
Not every plugin screen is a Settings API options page. Sometimes you need a dedicated admin area — a reports dashboard, import tool, onboarding wizard, or documentation hub. WordPress registers those with the admin menu API: add_menu_page() for top-level items and helper functions like add_options_page() or add_management_page() for submenus.
Hand-coding menu registration, capability checks, render callbacks, and optional asset loading is repetitive. This guide explains the pattern and how the Admin Page Generator in Zelvigo Dev Studio Pro scaffolds it for you.
How custom admin pages work in WordPress
A typical custom admin page setup looks like this:
- Hook —
add_action( 'admin_menu', 'your_register_callback' ); - Register —
add_menu_page()(top-level) or a submenu helper under Settings, Tools, Appearance, or Plugins - Capability — who can see and access the page (e.g.
manage_options) - Render callback — outputs the page HTML inside wp-admin
- Assets (optional) — enqueue CSS/JS only on that screen via
admin_enqueue_scriptsand the page hook suffix
WordPress handles the menu chrome and routing to admin.php?page=your-slug. Your plugin supplies the callback and whatever UI belongs on the page.
Admin Page vs Settings API: the Settings API is built for saving options with sections and fields. The Admin Page Generator is for general-purpose screens — custom markup, tables, wizards, or anything that is not a standard options form.
Common mistakes when coding admin pages by hand
- Registering menus too early or on the wrong hook
- Using the wrong submenu helper for the parent (e.g.
add_submenu_pagewith a mismatched parent slug) - Capability set too low so non-admins reach admin-only tools
- Loading scripts globally instead of scoping to the page hook suffix
- Missing
settings_errors()or nonce checks when the page includes forms (even on non-Settings-API screens)
A generator gives you consistent menu registration and a render stub so you can focus on the page content instead of retyping the same boilerplate.
Generate admin pages with Zelvigo
In Zelvigo Dev Studio Pro, open Admin Page Generator → Create Admin Page and configure:
- Page slug — used in the menu and
admin.php?page=URL - Page title & menu title — browser title and sidebar label
- Menu type — top-level menu or submenu
- Parent menu — Settings, Tools, Appearance, or Plugins (for submenus)
- Capability — who can access the page
- Menu icon & position — for top-level menus (dashicon class)
- Assets stub — optional
admin_enqueue_scriptshook scoped to this page
Click Generate to get production-ready PHP: admin_menu registration, the correct add_*_page() call for your placement, a render callback with placeholder markup, and optional asset loading. Copy the code into your plugin or bundle it via Plugin Boilerplate.
Walkthrough: documentation.
Pair admin pages with other generators
Custom admin screens often sit alongside other Zelvigo Pro modules:
- Settings API — options page for configuration; separate admin page for reports or tools
- Admin Notices — nudge users on specific screens after you know the screen ID
- REST API — backend endpoints; admin page as the UI that calls them
- Plugin Boilerplate — export admin pages with CPTs, cron jobs, and widgets in one ZIP
Together they cover the full wp-admin surface area most client plugins need without rewriting menu registration on every project.
Next step
Learn the add_menu_page pattern once. Use a generator so every new plugin gets consistent admin menu scaffolding in minutes.
