How to Backup WordPress Properly
That feeling when you realize you should've setup backups but didn't (there's a meme for this right?) Recently a client asked what options are available for backing up their self-managed WordPress site. Let's look at some of the things to keep in mind, and what options there are to get your site backed up.
A few things to keep in mind about backups
Before we get into some of the ways you can backup your site, let's look at a few important factors.
It sounds obvious, but backups are most useful when they're actually up-to-date with the latest changes. The last thing you want after your site goes down is to find out the only backup is the one your web developer has from when they launched the site 9 months ago. If backups happen automatically, you'll never need to be in that position.
Keep your backups somewhere safe
Many servers and web hosting plans come with the ability to automatically generate backups—but those archives are often saved in the same place as your live website. If the server your site is on fails, your site, and your backups go with it. Keeping the backups offsite, on a separate server or with a cloud storage provider will ensure you always have a backup.
Incremental backups are best
In a typical WordPress installation, your site information is stored in two places: the content and configuration information in the database, and the theme, plugin and media files in the
wp-content folder. Basic backup systems combine all that information together in one big archive, each time a backup is generated.
This works, but over time you'll quickly have huge volumes of duplicated data in those backups. With incremental backups, once you've generated the first backup, only new content and changes to the site will be backed up each time the backup runs. This saves on disk space, processing power, and bandwidth—factors that can save you money, and probably also contributes to a lower carbon footprint.
4 ways to setup your backups
With those things in mind, here are some of the ways to setup your backups:
Use the backups from your hosting company
Depending on how your WordPress site is hosted, you might have automatic backups included with your plan. Managed hosting services like WP Engine and Pressable include automatic backups, often with convenient "one-click restore" features enabling you to quickly rollback your site if something goes wrong.
If your web host doesn't include adequate backups, JetPack is a simple and inexpensive choice. Install the plugin and signup to their basic plan for automatic daily, offsite backups with the ability to one-click restore a previous version of the site.
Do it yourself
For advanced users who need tight control over where and how their data is stored, or for developers who prefer a DIY setup. The exact steps for this approach will vary widely, but given the open nature of WordPress it's always an option for those who need it.
Be sure to create an automated task on your server to generate the backup—there are lots of existing scripts to build form. Secondly, be sure to setup an additional step to transfer the backup to a separate server or cloud provider.
I'd recommend only taking this approach if you really need the control over where the backups are stored, because the whole setup will be a bit fragile.
UpDraftPlus or BackWPUp Plugins
Somewhere in between the fully DIY approach and the fully managed approach of JetPack is to use a plugin like UpdraftPlus or BackWPUp. The free versions of both plugins allow you to generate automatic backups without writing any code, and store them on a variety of storage providers like Google Drive, DropBox or a Amazon S3.
Whatever option makes the most sense for the site you're working on, make sure you set it up as soon as your site is live!