Skip to content

CLI, Import/Export & Troubleshooting

Navigation ships five processwire-console commands (navigation:* and make:navigation), all supporting --json output for CI/CD automation.

Lists every registered menu, its source (yaml, db, or hybrid), maxDepth, cacheTtl, and persisted node count:

Terminal window
php vendor/bin/wire navigation:list --json

Scaffolds a new YAML menu definition in site/navigation/{handle}.yaml or creates a database-backed menu (--db):

Terminal window
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.

Clears in-memory, WireCache, and registry caches for one menu or all menus:

Terminal window
php vendor/bin/wire navigation:clear --menu=main --json
php vendor/bin/wire navigation:clear --json

Exports one or all menus and their node hierarchies to a .json file (or --stdout):

Terminal window
# Write to default site/assets/backups/navigation/ folder
php vendor/bin/wire navigation:export --json
# Export a single menu to an explicit file or stdout
php vendor/bin/wire navigation:export site/assets/backups/main-nav.json --menu=main --json
php vendor/bin/wire navigation:export --menu=main --stdout

Imports menus and hierarchical node trees from a .json bundle:

Terminal window
# Dry-run validate first
php 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 --json
php 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).

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).
  • Confirm the file lives in site/navigation/{handle}.yaml with valid YAML syntax and run php vendor/bin/wire navigation:clear --json.
Section titled “navigation:import --mode=replace --json Returns CONFIRMATION_REQUIRED”
  • Destructive replace imports 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 Page is unpublished, hidden (when includeHiddenPages is false), or uses a protected system template. When sync_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 (or navigation-admin) and, if the menu sets a custom permission:, that the exact ProcessWire permission exists and is assigned to the user’s role. Invalid permission names fail closed by design.

Next steps