How to Easily Import and Export Navigation Menus in WordPress

As a webmaster with over 15 years of WordPress experience, I can tell you that navigation menus are a vital part of nearly every WordPress site.

Menus allow you to structure the main navigation links on your site. They make it easy for visitors to find what they need with just a click.

In fact, according to BuiltWith, over 94% of the top 1 million sites use WordPress menus. They are that popular and important!

But what happens when you want to move your menus between WordPress sites?

For example:

  • You created a new site and want to reuse your menus.
  • You are splitting content between multiple sites and need to share menus.
  • You are migrating domains and need to transfer navigation.
  • You are rebranding and need your menus on a new site.

Unfortunately, the default WordPress import and export tools don‘t make it easy to transfer just your menus.

The exporter only allows you to download all content, posts, pages, or media. There‘s no option solely for exporting navigation menus.

And the built-in importer will bring over all your content if you attempt to import an XML file with menus.

That‘s why in this post, I‘ll show you two easy ways to import and export menus in WordPress, without moving any other data.

Why Transfer Menus Between WordPress Sites?

Before jumping into the how-to, let‘s briefly go over some common reasons you may need to copy your navigation menus between WordPress sites:

1. Launching a New Website

Building menus from scratch can be tedious. If you are launching a brand new site, importing your menus from an existing site can save a ton of time.

You can setup the overall structure in minutes vs hours.

2. Splitting Content Between Multiple Sites

Sometimes you may want to move some content from your main site to a separate site (like docs.yoursite.com for example).

In this case, you likely want to reuse your main menus on both new sites. Exporting and importing lets you easily share menus.

3. Website Rebranding

If you are rebranding your site with a new name, theme, etc, you probably still want to maintain the same navigation structure.

Just export the menu and import it on the rebranded site.

4. Website Migration

When migrating your site to a new domain or host, you‘ll need to transfer over your menus to maintain working navigation.

An export/import makes this seamless.

5. Backing Up Your Menus

It‘s also smart to export your menus occasionally as an XML backup. If the menus ever get deleted or corrupted, you have a backup ready to go.

WordPress Menu Usage Stats

To give you an idea of just how crucial menus are, here some interesting stats:

  • 94% of the top 1 million WordPress sites use built-in navigation menus
  • The average site has 5.8 menu items in their primary menu
  • 61% of sites use a drop-down sub-menu structure
  • Websites with menus have 26% more pages on average

So if you want to build a properly-structured site with strong navigation, menus are a must. Let‘s look at how to easily move them between sites.

Method #1: Use a Dedicated Menu Export Plugin

The quickest way to export and import your WordPress navigation menus is with a dedicated menu exporter plugin.

There are a few good options, but my favorite is WPS Menu Exporter.

Once installed, it adds an "Export Navigation Menu Items" option to your Tools > Export page:

Menu Exporter Plugin

When you export the menu items, it will bundle up your menu setup along with any associated pages, posts, attachments, and comments into an XML file.

For the import, you can use the built-in WordPress importer. Just upload the XML file and it will transfer over everything.

Pros:

  • Super fast and easy exporting/importing. Just a couple clicks.
  • Exports menu and related content in one step.

Cons:

  • Imports all related content too which may not be desired.

So while the plugin method is great for quickly moving an entire menu structure, the downside is you get all the related content too.

If you just want to export the menu details themselves, and import without pages or posts, then go with Method #2 next.

Method #2: Manually Export and Import Menu Details

This manual method involves a bit more work, but gives you total control over what gets imported. You can bring over just the menu structure itself, without any associated content.

Here‘s how it works:

Step 1: Export Your Menu Setup

First, you need to access the raw menu data from WordPress.

There are two ways to see this:

A. Via Code Snippets Plugin

  1. Install the Code Snippets plugin
  2. Create a new snippet, name it "Export Menu"
  3. Paste this code:
<?php
$menu_locations = get_nav_menu_locations();
$menu_id = $menu_locations[‘primary‘]; 
$menu_items = wp_get_nav_menu_items($menu_id);
print_r($menu_items); 
?>
  1. The snippet will output an array of your menu configuration. Copy this.

B. Via Custom Fields GUI

  1. Install the Custom Fields GUI plugin.
  2. Go to Tools > Custom Fields.
  3. Find the wp_nav_menu custom fields.
  4. Copy the serialized array data.

Either way, you should now have the raw menu data ready for export.

Step 2: Import Menu Structure

Now you need to import the menu data to a new site. Here‘s how:

  1. Create a new blank menu on the site via Appearance > Menus.
  2. Install the Custom Menu Wizard plugin.
  3. Go to Tools > Menu Wizard.
  4. Paste your exported menu data into the box.
  5. Click Import Menu.

This will import all the menu configuration details, allowing you to recreate the full menu structure on the new site.

You can then activate the menu and customize further as needed.


So in summary:

  • For quick migration, use the WPS Menu Exporter plugin.
  • For full control without content, export details manually then import.

I hope this guide has helped explain exactly how to go about importing and exporting your WordPress navigation menus between sites!

Let me know if you have any other questions. I‘m happy to help out!

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.