What is the easiest way to duplicate an entire navigation menu? I don't care if it involves SQL commands or whatnot. I just have some really big menus that I'd like to duplicate. I didn't see a plugin to do this.

For clarification, I want to duplicate the menu so I can make some edits to it and use it as a secondary menu elsewhere. I'm not trying to display the menu twice.

  • elsewhere = a different site? Sep 21, 2011 at 23:38
  • no, on the same site.
    – cwd
    Sep 22, 2011 at 0:21
  • If the menu will keep its structure, then I don't see any logical reason to duplicate it. You can use the same menu, and style it differently if that's what you want. Sep 22, 2011 at 1:00
  • i guess the question is not clear enough or you guys are not reading. the question does say that I am going to make edits. anyhow, consider this scenario and tell me how you would best deal with it: you have a menu with 200 items and want to keep the first 100 in that menu while moving the next 100 to a second menu. the menu items are nested and some of them have custom titles, and custom links. my preferred method would be to duplicate the whole menu and then delete the ones i didn't need. however, it brings me to a fundamental question: what is the easiest way to duplicate a menu?
    – cwd
    Sep 22, 2011 at 4:24
  • 1
    menu items are custom post type objects with a post_type of nav_menu_item. So you can query, modify and insert them exactly like (custom) post (types).
    – kaiser
    Oct 10, 2011 at 10:22

3 Answers 3


UPDATE: The "easiest" way is to use my new plugin: http://wordpress.org/extend/plugins/enhanced-menu-editor/

It's not approved yet, but once it is I'll publish the widget. Not only does it allow for copying menus, but you can also synchronize the menu structure you establish in the menu editor to the page heirarchy of the pages themselves. So you can use drag-n-drop ajax coolness instead of editing potentially hundreds of pages manually.


The "easiest" way is to use code. There are two functions you'll want to use:

wp_create_nav_menu() which creates the menu itself and returns the menu_id wp_update_nav_menu_item() which will create a new menu item if you pass in 0 for the menu item id param.

Then you could use a wp_nav_menu walker class to iterate over each of the existing items in a menu. This website will give you a good reference point to start with that.


So you call the create nav menu function first.

Then implement the nav walker on a given page. Inside your walker class's start_el function, you'll have access to the $item param that will allow you to call wp_update_nav_menu_item() with identical properties as the existing menu, but just pass 0 instead of the item's real id, which will create a new menu item.

The only other property you'll need to consider is the menu-item-parent-id because you'll want that to reference your newly created menu item and not the old one on the other menu. For this you'll need to create an array that keeps track of old id's to new id's.

If you'd like a concrete example of this solution just email me at marcuspope.com and I'll see what I can whip up.

Hope that helps! -Marcus

  • I would love a concrete example :)
    – cwd
    Nov 23, 2011 at 20:26
  • I'm about 90% complete with a plugin that will do this plus a bunch of other handy menu management features. I'll try to throw a blog post up soon if I can't finish the plugin before the holidays. I'll update this answer when I do :) Nov 28, 2011 at 21:56
  • Any luck on getting that plugin working?
    – cwd
    Jan 10, 2012 at 17:55
  • Ugh, unfortunately no - I've been sidelined with a series of projects at work and haven't had a chance to complete the code. Here's a code sample that should get you going pastebin.com/hV20hKzJ Apr 12, 2012 at 22:14
  • just got back to take a look at this question again and I see you've finished your plugin. Thanks! Only thing I'd love to see is some screenshots on the plugin page :)
    – cwd
    Sep 20, 2012 at 18:59

So I was struggling with a similar issue

  1. I wanted to create lots of menus to displayed based upon permissions... lots of the items were duplicates etc so the easy way was likely to somehow copy something that already existed

  2. I then needed to migrate all those menus to multiple blogs which share the same permissions.

But I am only a half-hearted programmer.

So this is the kludge solution but it seems to work, no programming required

WP has an export function - if you have a clean blog (and maybe even if you haven't) it seems all the menu items get listed in the same part of the export file.

There are only 2 things (possibly) if you are dealing with a single blog that need to be changed, as posts and pages will be skipped anyway due to duplicate slugs

This is the definition for the menu's custom category. You need to change the slug and the CDATA (where is says "FA" in my example)


Next you need to do a search and replace for all the menu items related to that slug / category.

<category domain="nav_menu" nicename="FA"><![CDATA[FA]]></category>

Again look for the "FA"

Save the XML with a nice clean filename.

Then you use the WP importer plugin to import the XML

YMMV but WFM and saved me a ton of time

  • Better than any of the other answers so far, thanks!
    – cwd
    Jan 10, 2012 at 17:55

Seriously quick & dirty but seemingly functioning alternative for DEV purposes only:

  1. Make a note of the existing menu id
  2. Create new menu and make a note of that menu id too
  3. Execute following MySQL query:
insert into wp_term_relationships (

Disclaimer: This is only for developers who quickly want to make a proof-of-concept on something in a sandbox. Never do this on a database which you would like to preserve in a stable state in the future.

For instance, you're referring to the same menu items in two menus, which probably is a bad idea in the long run. Also, you're skipping all WP hooks which may or may not cause a number of undesired outcomes, depending on your case.

Friendly note: If you can't find the menu id, you probably shouldn't use this solution.

Not the answer you're looking for? Browse other questions tagged or ask your own question.