Skip to content

Instantly share code, notes, and snippets.

@qutek
Forked from Niq1982/wpcli-ai1wm.md
Created September 17, 2023 05:27
Show Gist options
  • Save qutek/551a713dbcc92667a3199d2c8275a063 to your computer and use it in GitHub Desktop.
Save qutek/551a713dbcc92667a3199d2c8275a063 to your computer and use it in GitHub Desktop.
Site migration using All in One WP Migration and WP CLI

Do a backup

Install the plugin

wp plugin install all-in-one-wp-migration --activate

You must reload the page once before continuing

Do the backup

Adjust the settings for your own need, this here makes a backup of the database only. I suggest using rsync to sync media files.

wp ai1wm backup --exclude-media --exclude-themes --exclude-inactive-themes --exclude-muplugins --exclude-plugins --exclude-inactive-plugins --exclude-cache

Remove the plugin

wp plugin deactivate all-in-one-wp-migration --uninstall

Restore a backup

Go to backup directory or create if does not exist

cd wp-content/ai1wm-backups/

Download the backup

wget http://siteurl.fi/wp-content/ai1wm-backups/backup-20180105-142530-313.wpress

Install the plugin

wp plugin install all-in-one-wp-migration --activate

You must reload the page once before continuing

Restore the site from backup

wp ai1wm restore backup-20180105-142530-313.wpress

Not sure if necessary to flush permalinks twice, like when restoring from front end, but do it once or twice if you encounter problems.

wp rewrite flush

Remove the plugin and delete the backup file

wp plugin deactivate all-in-one-wp-migration --uninstall

rm backup-20180105-142530-313.wpress

Remember to remove the unneeded backup files from the source as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment