CLI, Import/Export & Troubleshooting
Navigation ships five processwire-console commands (navigation:* and make:navigation), all supporting --json output for CI/CD automation.
CLI Command Reference
Section titled “CLI Command Reference”1. navigation:list
Section titled “1. navigation:list”Lists every registered menu, its source (yaml, db, or hybrid), maxDepth, cacheTtl, and persisted node count:
php vendor/bin/wire navigation:list --json2. make:navigation
Section titled “2. make:navigation”Scaffolds a new YAML menu definition in site/navigation/{handle}.yaml or creates a database-backed menu (--db):
php vendor/bin/wire make:navigation main \ --title="Main Header Navigation" \ --max-depth=3 \ --icon=menu-2 \ --dry-run \ --json
# Create a database-backed menu (pass --force to overwrite an existing menu)php vendor/bin/wire make:navigation promo --title="Seasonal Promo" --max-depth=2 --db --force --json| Flag | Behavior |
|---|---|
<handle> (argument) |
Normalized menu handle (main, footer, mobile). |
--title (-t) |
Human-readable menu title. |
--max-depth (-d) |
Maximum nesting depth from 1 to 10 (default 3). |
--icon (-i) |
Icon identifier (default menu-2). |
--db |
Create the menu in navigation-menus instead of writing a YAML file. |
--dry-run |
Preview scaffold output without writing files or database rows. |
--force (-f) |
Overwrite an existing YAML file or database menu. |
--json |
Emit JSON summary. |
3. navigation:clear
Section titled “3. navigation:clear”Clears in-memory, WireCache, and registry caches for one menu or all menus:
php vendor/bin/wire navigation:clear --menu=main --jsonphp vendor/bin/wire navigation:clear --json4. navigation:export
Section titled “4. navigation:export”Exports one or all menus and their node hierarchies to a .json file (or --stdout):
# Write to default site/assets/backups/navigation/ folderphp vendor/bin/wire navigation:export --json
# Export a single menu to an explicit file or stdoutphp vendor/bin/wire navigation:export site/assets/backups/main-nav.json --menu=main --jsonphp vendor/bin/wire navigation:export --menu=main --stdout5. navigation:import
Section titled “5. navigation:import”Imports menus and hierarchical node trees from a .json bundle:
# Dry-run validate firstphp vendor/bin/wire navigation:import site/modules/Navigation/examples/real-world/navigation-seed.json --mode=upsert --dry-run --json
# Destructive replace mode requires --force when non-interactive or with --jsonphp vendor/bin/wire navigation:import site/assets/backups/main-nav.json --mode=replace --force --json| Flag | Values / Behavior |
|---|---|
<path> (argument) |
Path to a .json file (symlinks rejected). |
--mode |
upsert (merge and update), replace (clear existing unlocked nodes in imported menus first), or skip (import only new menus/nodes). |
--dry-run |
Validate JSON payload and report counts without writing. |
--force (-f) |
Required for non-interactive or --json runs using --mode=replace. |
--json |
Emit JSON summary (menus, nodes, skipped, dryRun). |
NavigationPorter Safety Limits
Section titled “NavigationPorter Safety Limits”Both the Admin JSON Import dialog and navigation:import enforce strict bounds:
- Maximum JSON payload size: 10 MB (
NavigationPorter::MAX_IMPORT_BYTES = 10485760). - Maximum menus per import: 500 (
MAX_IMPORT_MENUS). - Maximum nodes per menu: 5,000 (
MAX_IMPORT_NODES_PER_MENU). - Maximum total nodes per import: 20,000 (
MAX_IMPORT_TOTAL_NODES).
Cache Invalidation & Troubleshooting
Section titled “Cache Invalidation & Troubleshooting”A Newly Added YAML Menu Does Not Appear
Section titled “A Newly Added YAML Menu Does Not Appear”- Confirm the file lives in
site/navigation/{handle}.yamlwith valid YAML syntax and runphp vendor/bin/wire navigation:clear --json.
navigation:import --mode=replace --json Returns CONFIRMATION_REQUIRED
Section titled “navigation:import --mode=replace --json Returns CONFIRMATION_REQUIRED”- Destructive
replaceimports delete existing nodes in matching menus before importing. Pass--force(or test first with--dry-run) in non-interactive shells and CI scripts.
A Page Node Disappeared From the Frontend Menu
Section titled “A Page Node Disappeared From the Frontend Menu”- Check whether the linked ProcessWire
Pageis unpublished, hidden (whenincludeHiddenPagesisfalse), or uses a protected system template. Whensync_status = true, unpublished targets hide automatically. - If you updated pages via raw SQL outside ProcessWire hooks, call
$navigation->invalidateForPage($pageId, $parentPageId),$navigation->invalidateForEntry($entry), or$navigation->clearCache().
A Menu Cannot Be Edited by a Non-Superuser
Section titled “A Menu Cannot Be Edited by a Non-Superuser”- Verify the user holds
navigation(ornavigation-admin) and, if the menu sets a custompermission:, that the exact ProcessWire permission exists and is assigned to the user’s role. Invalid permission names fail closed by design.