How to Export and Import WordPress Menus (Classic and Block Themes)

To export WordPress menus without a plugin, go to Tools>Export, leave All content selected and click Download Export File. That XML file includes every classic menu, every block theme Navigation menu, and the pages, posts and categories the menu items point to. Import it on the other site with the free WordPress Importer plugin under Tools>Import.

WordPress core has no “menus only” export option. If you want a file with just the menus, the free Export WordPress Menus plugin adds a Navigation Menu Items choice to the export screen. A menus-only file made any other way usually imports with most of its links missing, and the sections below show why.

Everything here was tested on WordPress 7.1 with WordPress Importer 0.9.7, using a classic theme (Twenty Twenty-One) and a block theme (Twenty Twenty-Five).

MethodBest forWhat comes acrossCatch
Tools > Export, All contentFull migrations, staging to liveMenus, menu items, the content they link to, Navigation block menusBrings every post and page too; theme menu locations are not included
Export WordPress Menus pluginClassic menus onlyMenus, items, linked posts, pages and termsUnmaintained since March 2021; custom post type items are not bundled
Import Export Menu pluginClassic menus between existing sitesMenus as a JSON file, remapped by slugNeeds the plugin on both sites
Site Editor code editor (copy and paste)One Navigation block menuThe menu block markupPost IDs inside the links are not remapped
WP-CLIScripted or repeat movesWhatever you list or exportThere is no wp menu export command
Ways to export and import WordPress menus

What a WordPress menu export actually contains

A classic WordPress menu is stored in two parts. The menu itself is a term in the nav_menu taxonomy, and each link in it is a post of the type nav_menu_item. The export file (WXR, short for WordPress eXtended RSS) writes both. In our test export, each menu item carried these fields:

Field in the exportWhat it holdsExample from the test
_menu_item_typepost_type, taxonomy or custompost_type
_menu_item_objectWhich kind of objectpage
_menu_item_object_idThe ID of the page, post or term on the old site4
_menu_item_menu_item_parentParent menu item ID, for dropdowns0
_menu_item_urlOnly filled for custom linkshttps://old-site.com/shop/
_menu_item_classes, _menu_item_targetCSS classes and “open in new tab”cta highlight
nav_menu category tagWhich menu the item belongs to (by slug)main-menu
Menu item data inside a WXR file

Two things follow from that. Page, post and category items are stored as an ID, not a URL, so the importer has to match that ID to something on the new site. Custom links store a full URL, so they keep whatever domain they had when you exported.

The file also leaves out which menu sits in which theme location (Primary, Footer and so on). That setting lives in the theme options, not in posts, so you reassign it after every import.


Export all content, including menus (no plugin)

Start here for a migration or a staging push, because the menu items and the objects they point to travel in the same file.

  • On the old site, open Tools>Export. The All content description on that screen lists “navigation menus” among what it includes.
  • Click Download Export File and save the XML.
  • On the new site, open Tools>Import, find WordPress, and click Install Now, then Run Importer.
  • Upload the file, assign authors, and tick Download and import file attachments if you want media too.
  • Go to Appearance>Menus, open Manage Locations, and assign the imported menu to its theme location.
Export options in WordPress
WordPress export menu

In the test, a five-item menu (two pages with a parent and child, a category, a custom link and a third page) came through complete: the hierarchy, CSS classes and the “open in new tab” setting all survived, and the page items pointed at the newly imported pages. The menu was not assigned to any location until we set it by hand.

If you are moving the whole site rather than a few pieces of content, a full-site tool from our list of WordPress migration plugins is less work, since it carries the database, theme options and menu locations in one go.


Export only your menus with a plugin

Core does not offer a menus-only option on the export screen. The Export WordPress Menus plugin by Tyche Softwares adds one. It still worked on WordPress 7.1 in our test, but its last update was March 2021 and it was last tested with WordPress 5.7, so install it for the export and remove it after. Our guide to abandoned WordPress plugins explains why leaving unmaintained plugins active is a risk.

1. Install and Activate Export WordPress Menus

Search for “Export WordPress Menus” under Plugins>Add Plugin and activate the one by Tyche Softwares. If you have not done this before, here is how to install a WordPress plugin.

Export WordPress menus by Tyche Softwares

2. Run the WordPress Export Tool

Go to Tools>Export. With the plugin active, a new Navigation Menu Items option appears in the list. Select it and click Download Export File.

Exporting navigation menu items in WordPress
Export navigation menu items

The plugin does more than filter the export. Its file adds the menu definitions, the categories or tags used as menu items, and the posts and pages the menu links to. That is what lets the import rebuild the links. Items that point at custom post types (products, portfolio items) are not bundled, so those need to exist in the same import or they will be dropped.

3. Import WordPress Navigation Items

On the destination site, go to Tools>Import and click Run Importer under WordPress (install it first if you see Install Now).

WordPress import option
WordPress import option
Running the WordPress importer

Upload the file, assign the imported content to an author, and submit.

Assign authors screen in the WordPress Importer

When it finishes, the menu shows up in Appearance>Menus. Assign it to a location under Manage Locations, since that part never comes across.

Pages in the file that already exist on the new site, matched by the same title and the same publish date, are reused instead of duplicated. A page with the same title but a different date is not a match: in our test, an existing “About” page with a different date led the importer to create a second one at /about-2/ and point the menu there.


It is tempting to export only the nav_menu_item post type, for example with WP-CLI. We tried files like that against the WordPress Importer, and they fail in two ways.

  • Without the menu definition in the file, every item is rejected with “Menu item skipped due to invalid menu slug: main-menu”. The core export only writes menu definitions when you choose All content.
  • With the menu present, only custom links import. Page, post and category items were dropped silently, with no error on screen, even when the destination site already had the exact same pages.

The second one surprises people. Looking at the importer code, it only maps a menu item to a page that was processed in the same import, either newly created or matched to an existing one. A page that is not in the file never gets mapped, so the item waits for an object that never arrives and is discarded at the end. The fix is to export the menu together with the content it links to, which is exactly what All content and the Export WordPress Menus plugin do.


Block themes: exporting Navigation block menus

Block themes such as Twenty Twenty-Five do not use Appearance>Menus. Menus live in the Navigation block, and each menu is saved as its own post of the type wp_navigation. You manage them under Appearance>Editor>Navigation. The header template only stores a reference to that post, such as <!-- wp:navigation {"ref":55} /-->.

Here is how the export options handled a block theme menu in our test:

Export optionIncludes the menu links?Notes
Tools > Export, All contentYesExports the wp_navigation post and any customized template parts. There is no separate Navigation option in the list.
Site Editor: Options (three dots) > ExportNoDownloads a theme zip whose header part contains only the ref number, not the links.
Code editor copy and pasteYesCopies the link blocks for one menu.
Block theme navigation export behavior on WordPress 7.1

The importer does not rewrite IDs inside block markup. When we imported an All content file into a site where the old IDs were already taken, the Navigation post came in under a new ID, but the header still pointed at the old number, so the header rendered with no menu links. Each link block also keeps the old page ID and a hard-coded URL.

So after importing a block theme site:

  • Open Appearance>Editor, select the Navigation block in your header, and pick the imported menu in the block settings. That saves the new reference.
  • Click through each menu link and reselect its page if the site has new IDs or a new domain.

Copy a Navigation menu with the code editor

For moving a single menu, copy and paste is fastest. Open Appearance>Editor>Navigation, choose the menu, and click Edit. In the Options menu (three dots, top right) switch to Code editor (Shift+Option+Command+M on a Mac, Ctrl+Shift+Alt+M on Windows). You will see the raw link blocks:

<!-- wp:navigation-link {"label":"About","type":"page","id":65,"url":"https://old-site.com/about/","kind":"post-type"} /-->
<!-- wp:navigation-link {"label":"Docs","url":"https://example.com/docs/","kind":"custom"} /-->

Copy it, open a menu on the destination site the same way, switch to the code editor and paste. Before saving, change the domain in each url, and fix or remove the id values: a link whose ID points at a post that does not exist or is not published is hidden on the front end.


Export and import menus with WP-CLI

WP-CLI has a wp menu command with create, delete, item, list and location subcommands. There is no wp menu export or wp menu import (checked against WP-CLI 2.12). These are the useful pieces:

# See menus and their items on the source site
wp menu list
wp menu item list main-menu --fields=db_id,type,object,object_id,title,link

# Full export that keeps menus and the content they link to
wp export --dir=./export

# On the destination (needs the WordPress Importer plugin)
wp plugin install wordpress-importer --activate
wp import ./export/*.xml --authors=skip

# Menu locations are not in the file, so set them again
wp menu location list
wp menu location assign main-menu primary

wp export --post_type=nav_menu_item does include the menu definition, unlike the admin screen, but it hits the same wall as above. In our test the page and category items were dropped on import and only the custom link survived. Adding pages (--post_type=page,nav_menu_item) brought the page items back, yet the category item was still lost because categories were not in the file.

For small menus on a site that already has the same content, rebuilding with wp menu item add-post, add-term and add-custom from the wp menu item list output is often cleaner than importing at all.

If you changed domains, custom links and Navigation block links still carry the old address. Run wp search-replace 'https://old-site.com' 'https://new-site.com' --dry-run first, then without --dry-run. Our mixed content guide covers the same command for http to https changes.


Maintenance status below comes from the WordPress.org plugin directory on November 9, 2026.

PluginLast updatedTested up toActive installsHow it works
Export WordPress MenusMarch 12, 20215.71,000+Adds a Navigation Menu Items option to Tools > Export; import with WordPress Importer
Import Export MenuOctober 6, 20267.03,000+Exports menus to a JSON file; its importer matches items to content by slug, then path, then title, and can assign theme locations
WordPress ImporterOctober 20, 20266.82+ millionThe official importer for WXR files from Tools > Export
Menu export and import plugins

We tested Export WordPress Menus and WordPress Importer hands-on. The Import Export Menu details come from its plugin page. Its matching by slug is the main reason to pick it when both sites already have the same pages but different IDs.


Troubleshooting menu imports

ProblemCauseFix
“Menu item skipped due to invalid menu slug”The file has menu items but not the menu itselfRe-export with All content or the Export WordPress Menus plugin, or create a menu with the same slug first
Only custom links importedPages, posts or terms the items point to were not in the same fileExport the menu together with its content
Menu imported but not showingTheme locations are not exportedAppearance > Menus > Manage Locations, or wp menu location assign
Every item appears twiceThe same file was imported twice; the importer skips existing pages but adds menu items againDelete the duplicates, or delete the menu and import once into a clean menu
Links go to the old domainCustom links and Navigation block links store full URLswp search-replace or edit those links by hand
Menu points to /about-2/A same-titled page with a different publish date already existed, so a second copy was createdDelete the duplicate page and reselect the original in the menu
Block theme header shows no menuThe header still references the old Navigation post IDSelect the Navigation block and pick the imported menu
Common WordPress menu import problems

Before any import on a live site, take a backup. Our guide on how to back up a WordPress site covers five ways to do it.


FAQ

Can you export a WordPress menu to another site without a plugin?

Yes. Use Tools > Export with All content, then import the file with the WordPress Importer on the other site. Menus, items and the content they link to come across together. You only need a plugin if you want a file with nothing but the menus.

Does Tools > Export include menus?

Only when All content is selected. That option includes classic menus and block theme Navigation menus. The Posts, Pages and Media options leave menus out, and core has no separate Navigation Menu Items option unless a plugin adds one.

Why are my menu items missing after import?

The WordPress Importer drops page, post and category menu items whose target was not part of the same import, without showing an error. Custom links still import because they store a full URL. Export the menu together with its pages, posts and categories.

Does the Site Editor export include navigation menus?

No. The Export option in the Site Editor downloads a theme zip with your templates and styles. The header part only contains a reference number for the Navigation menu, not the links themselves. Use Tools > Export or copy the menu through the code editor.

Is there a WP-CLI command to export menus?

No. WP-CLI has wp menu list, wp menu item list and wp menu location, but no export or import subcommand. Use wp export for a full WXR file and wp import on the destination, then reassign locations with wp menu location assign.

Picture of Andy Feliciotti

Andy Feliciotti

Andy has been a full time WordPress developer for over 15 years. Through his years of experience has built 100s of sites and learned plenty of tricks along the way. Found this article helpful? Buy Me A Coffee

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Tips Monthly
Get the latest from SmartWP to your inbox.