[wp-hackers] Exporting Menus

Andrew Gray andrew at graymerica.com
Wed Sep 1 02:40:32 UTC 2010


We just launched two sites in two days and I just got done with the same problem twice.

How do I move the menus (WP 3.0) from one site to another.

Here is the example for adding a menu via a function:  http://new2wp.com/snippet/register-and-create-new-nav-menus-with-default-menu-items/

We looked at the code for creating a menu via a function and it is pretty straight forward,  but how do I build that array from an existing menu structure.   We looked at doing it via straight SQL but it looked risky.  Trying to Walk the menu and get menu items seems like the only way to do it.

Does anyone have anything that can export a menu from one site, so it can be imported into another.

I keep trying to build tools that help us move sites from Development to Staging to Production in a more automated way, without having to replace the entire DB, but I keep running into road blocks.    Right now the menus, widgets and SIte URL coded into the DB are my three major sticking points.

There are alot of ideas out there on how to deal with some of these, but I wanted to see what the group had to say about this.   Are these issues for other people as well?

I deal with this because of the types of blogs I build.  The content is being created constantly, and we can move data from the development side.  But it sucks to have to manually create all the menus and widgets when you deploy a site.  Also, the chances of messing something up are higher.     

I have an idea for deployment script, and will certainly release it as a plugin, but I am still collecting tips and code before I start coding it,

Thanks,

Andrew





More information about the wp-hackers mailing list