2

I am relatively new to working with WordPress, but I am very comfortable with, and prefer to use the command line. I need to backup WordPress before performing a version upgrade. I came across wp-cli and I assume that it is the go-to utility for working with WordPress on the command line.

When working with WordPress, what do I need to back up, and how can I do this from the command line?

Bonus question: how would you go about automating this to perform regular backups?

2

You can use the WP-CLI command wp db export <filename>

Run the command from within the home directory for the install.

Now, you have a database included in your files. Zip up the directory and move it aside. Now you can perform the upgrade, and if something breaks, replace with the old site and import the old database. voila, previously working site restored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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