WP Manifestindependent plugin directory
manifest / multisite / libpress-menu-mgmt

LibPress Menu Management

Adds functionality for network-wide exporting for backup

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/bclibcoop/libpress-menu-mgmt/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Running for single site

Find blogID and URL

wp site list |grep maple

export BLOGID=73

Run command

wp libpress-export-blogmenus --blogid=$BLOGID

Saves backup file in WXR format to path specified in MENU_MGMT_EXPORT_DIR, organized by Blog domain.

Defaults to /home/siteuser/libpress_menu_backups/{domain}/ on LibPress.

Running network-wide (in cron)

wp libpress-export-blogmenus --network

Full cron run, for example:

cd /var/www/libpress.libraries.coop/current && /usr/local/bin/wp libpress-export-blogmenus --network &>/dev/null && gzip /home/siteuser/libpress_menu_backups/*/*.xml

Restoring a menu backup

Normally, without all pages/posts/terms linked to from the menu items, an import would fail and only import custom links. This plugin now includes functionality that dynamically adds referenced posts/terms from the menu into the importer, thus allowing an export with only menu items to be imported.

There are limitations however, insofar as a post/page/term may have been deleted between the export and the import. Efforts have been made to log errors when this occurs, but edge cases may exist where they are missed. Even when these errors are logged, if the missing item has child items, your menu probably doesn't look how it did when exported, so be aware of that.

Importing is a simple matter of

wp libpress-import-blogmenu /the/path/to/the/exportfile.xml

The blog URL will be pulled from the export file, so no other parameters are required. In addition, the XML file can also be imported via the normal WP Importer web interface.