Making regular backups of your WordPress sites is very important. Hopefully you never need the backup, but suppose your website gets hacked, the server crashes or maybe one of your co-workers messes up the site completely. Then you really need a backup to restore your website.
Although your webdeveloper probably has a recent version of all the files, does he have a recent version of your WordPress database? I would not count on it. Maybe your hosting company makes backups for you, but it is always best to have access to your backups yourself. Therefore, a backup plugin may be very useful. On quite some sites we developed in the past we have put the WordPress Backup 2 Dropbox plugin. This plugin is easy to install and configure and will create backups on a regular basis. Moreover, it makes a backup of both the files and the database, which is all you need.
Update August 7, 2015
However, it turned out that this plugin does not work with PHP version 5.6 at the moment. I was struggling getting the plugin to work for one of the sites we host, and finally I found this thread giving me the direction to solve the problem. Ask your host (or do it yourself) to run your site on PHP version 5.5 and this plugin will work like a charm!
Restoring a WordPress backup
So in this post I assume you have a backup made with the WordPress Backup 2 Dropbox plugin and you are in the situation where you need to restore this backup. Since I couldn’t find a post about this, I jumped into the subject myself and tried to put a copy of one of my own websites on my local machine. Not totally the same situation, but the steps involved are really similar. So, here we go:
- Assuming you have the WordPress Backup 2 Dropbox plugin correctly installed and configured, there exist a recent backup in your dropbox account. Usually, these backup are saved in their own directory. So go ahead and see if you have the folder Apps > wpb2d inside your dropbox account.
- If you have several websites that are using this plugin, the Apps > wpb2d directory contains a folder for each project (assuming you have configured the plugin to do this of course). Download a zipfile of your project by right-clicking your sites name and choose the ‘download’ option.
- Unpack the zipfile on your local computer. Now here comes a little weird thing. The backup of the database is a bit hidden inside the WordPress directory structure. It is located in wp-content > backups folder, the database is the file with the .sql extenxion.
- So we start the restore process by restoring the database. This is achieved by logging in on the phpMyAdmin interface and import the database file. Note that the server generally sets an upper limit on the file size for uploading files. If your backup file exceeds this file size you can import the database using the online Bigdump application. Their documentation is quite straight forward, so I’ll not dig into that today.
- (Optional) If you want to put the site in another domain it is time to change some settings in the database. In the wp_options table (note that the table prefix may be something different than wp), change the records for home and site_url. This process is detailed in a recent post on migrating a WordPress website.
- Now it is time to restore the files. Open your favourite FTP program and upload the unzipped root directory. After this it is important to remove the directory wp-content > backups, because in case your server gets hacked, your database could be stolen.
- (Optional) When restoring the site on another domain it is time to get all internal links working again. This can be achieved by a nice trick: Log in to the WordPress backend and go to settings > permalinks. Save this page (without changing anything) and your internal links will be updated.
So far the steps for restoring your WordPress backup. If you have a WordPress backup generated with another tool or plugin you probably can still follow these steps. What is important is that you have a full backup including all files and the database!
Still having trouble restoring the backup? Leave a reply!