I am in the process of handing over a site to someone who's not used WordPress before and doesn't necessarily know where what lives and how. I thought it would be a good idea for me to document how to use the free UpdraftPlus plugin.
I use the commercial version of this plugin because it is fire-and-forget for my multisite installation. But if you are running a standalone installation of WordPress then the free version is a good suitable option.
Install and configure UpdraftPlus
That goes without saying. You can navigate to your installation's Dashboard -> Plugins ->Add New and search for "UpdraftPlus". Other hits will come up but that should be the first plugin listed.
If you have a Google account then configure your plugin to use Google Drive. The OAuth2.0 can be a little complicated but this post on the UpdraftPlus site walks you through it. You'll need the "Google Drive Client ID" and "Google Drive Client Secret". Save that and you'll be prompted to authorize the app on Google's page via a link. It may take you a couple of tries but you'll get it.
Once that's done perform a full backup as a test to make sure it all works. When it is completed then your Google Drive will have a directory named UpdraftPlus and files like these in it.
I setup my plugin to backup all the files and database once a week as well as email me the results. That works for me but you may want to increase the backup frequency.
Off server backups are your friend and should be respected
I use Google Drive because it is convenient for me but any supported remote storage will work. Just do not keep your backups on your web server. Just don't. You want them to be somewhere safe and available when your site blows up.
By example I mean, if you just went to the web server directory and accidentally deleted all the files there and then dropped the database. Which I've just done to my test installation. Oh dear.
Install an empty WordPress in the smoking ruins of your site
I used mysql and wp-cli to install a new empty WordPress installation quickly and this time I used different a different DB name and DB user. You can install a new WordPress anyway you like as long as the URL hasn't changed. This is for restoration and not migration to another URL.
I installed the UpdraftPlus plugin on the new site and using the same Google OAuth2.0 credentials enabled my Google Drive access. Here comes the fun part.
On the UpdraftPlus Backup/Restore page I clicked Restore and then clicked "Rescan remote storage".
Look at that. There's my backup. Cool.
*Click blue Restore button selects all options and observes a warning*
The URL and directory hasn’t changed so I clicked the next Restore button. That got me this caution.
Cautions are good and you need to read them. This one is warning me that this new empty installation never saw this backup and wants to make sure I want to do this. *Clicks next Restore button*
Here's something really useful: I forgot that my table prefix changed and it adjusted the backup to match the new database table prefix. How cool is that?
When it completed I was prompted to re-login again and everything was restored correctly.
The new empty installation was completely replaced with the old, all of my many plugins were restored and activated as before, all the settings were back as they were. This despite that I had a different database name, different database user ID and different database table prefix.
I used the same WordPress ID and password so I am not sure what would have happened had I changed it but I suspect it would have been fine one way or another.
To recap
- Install the UpdraftPlus plugin.
- Configure it for remote storage.
- Configure it to automatically backup on a schedule.
- Email yourself when the backup occurs.
- Pay attentions and make sure the backup looks correct (size of back up files, etc.)
When the Bad Thing Happens™, and you better plan for that, then
- Install a new empty WordPress site where your site was with the Same URL.
- Install the UpdraftPlus plugin.
- Configure it for the same remote storage.
- Click Restore and re-scan Remote storage.
- Proceed to restore.
- Check that it's all good.
This is a very well written and friendly plugin. The author is constantly updating it and making improvements. The fact that the restore is so seamless is an added bonus and I recommend that people use it.