Skip to content

Menus

The menu command group syncs Block-based Navigation menus created via the Full-Site Editing interface. Menus are saved as a JSON file that you can commit and deploy.

Download all navigation menus from WordPress.

Terminal window
lps menu pull
FlagDescription
--configPath to the output JSON file (default: menus.json)

Example:

Terminal window
lps menu pull
lps menu pull --config ./theme/menus.json

The output file contains an array of navigation post objects including their block content and IDs:

[
{
"id": 42,
"name": "Primary Navigation",
"content": { "raw": "<!-- wp:navigation-link ... -->" }
}
]

Upload menus from a local JSON file back to WordPress. Each menu is matched by its id.

Terminal window
lps menu push
FlagDescription
--configPath to the source JSON file (default: menus.json)

Example:

Terminal window
lps menu push
lps menu push --config ./theme/menus.json
Terminal window
# 1. Pull menus from staging
lps site switch # select staging
lps menu pull --config menus.json
# 2. Commit to Git
git add menus.json && git commit -m "sync: menus from staging"
# 3. Push to production
lps site switch # select production
lps menu push --config menus.json
  • Menus are matched by id. If the production site has different menu IDs than staging, the push will update the wrong menus. Always verify IDs match before pushing across environments.
  • Only block-based Navigation posts are supported (i.e. menus created via the Site Editor, not the classic Appearance → Menus screen).