Have you ever heard of IFTTT? It has become pretty popular in geeky Social Media circles, and if you’re not using it yet, I bet I can change your mind. But now let’s get to the actual topic.
After I had started developing stuff for WordPress, I have always looked for an easy-to-use solution to backup my WordPress sites that is reliable and free. There are tons of plugins that can handle that for you, backing up the database in intervals you specify – and we will use one of them – but the problem is where to store the backups. On the server, you might answer. But if you don’t have the money to afford a high quality dedicated server or something like that, some hosting providers, for example Bluehost, forbid storing additional data that is not directly part of your website on their server – so they might shut down your account if they realize you have been backing up your files there regularly. You could also send the files to you via email, but this would not be very efficient as you would have to browse through your mails for finding a specific backup. This article, though, tells you how to automatically send your backups to a cloud platform like Google Drive (or any other) for free. It’s easy to setup, but it’s even easier after it has been setup – you don’t need to do anything about it. It only requires that you use a free WordPress backup plugin like BackUpWordPress, that you have a Google account with Gmail and Drive and that you have a free IFTTT account.
How To Use IFTTT to backup the WordPress database
Many parts of this tutorial can be done using several tools, but I’ve decided to do it with those I mentioned above. However, I will occasionally mention alternative services you could use to achieve a similar result. So these are the steps:
- If you’re not using it already, sign up at Google to use their Gmail and Drive services.
- Besides your Gmail address, you may also add other email addresses from other providers and access these emails using IMAP or POP3. If you want to use your Gmail address for the backups, the next three steps are not required and can be skipped.
- To add an external email account, click on the settings icon on the top right and choose “Settings”.
- Click on the “Accounts and Import” tab. Scroll down a bit and click “Add a POP3 mail account you own”. A tiny new window will open where you must insert the required data. The username, password, server and more should available from your email provider. If you can’t find this information, please contact your provider.
- After inserting all fields, you’re done. You can now read (and write) email from your external account using Gmail.
- Install and activate the plugin BackUpWordPress in the backend of your WordPress website. You will have a new menu item “Tools → Backups”.
- On this new settings page, you should select “Database Weekly” or “Database Daily”, according to how often you would like to receive backups via email.
- Click on the small “Settings” link to adjust your preferences. In the opening modal, you can specify how often you want this backup to happen. The most important thing though is that you enter your desired email address in the bottom field. This is where the backups will be sent. Furthermore you can set the field “Number of backups to store on this server” to 1 since you will mange your backups outside of your server.
Create the IFTTT Recipe
Before we actually create the recipe, let me give you a short introduction on IFTTT if you’ve never heard about it. IFTTT is a very helpful online service which you can use to optimize your online workflow, especially related to social media topics, but also other things. It is a connection of almost every popular platform out there. And the best thing about it is: Although you seemingly have unlimited possibilities to automize things, it’s really simple: IFTTT stands for “if this, then that”. Now if you’re a coder, you should know what that means. Otherwise, well, it’s actually what it expresses: With IFTTT you can define rules in the form “if this happens, then do that”. An example: “If I post a new photo on Facebook, send it to my Dropbox.” or “If it rains tomorrow, send me a text.” – yes, there’s even a weather channel on IFTTT. Of course you do not need everything there, but that is the good thing, it suits dozens of use-cases.
If you’re using Social Media often, you probably think “How cool is that?!” – at least that’s what I was thinking, and I still am. But this is not an in-depth tutorial about IFTTT. So let’s create our recipe for backing up the WordPress database now.
- Sign up for IFTTT and activate the channels Gmail and Google Drive if you’ve not already done so.
- Click on “Create” in the top menu to create a new recipe. As the trigger channel, select Gmail. For the trigger itself, choose “New email from search”. And in the field where you can enter the search query, please enter
subject:Backup of yourdomain.net, where you replace yourdomain.net with your actual domain. This query makes sure that the recipe is triggered everytime you receive an email with the subject “Backup of yourdomain.net” (this is how the WordPress plugin BackUpWordPress creates its subject name).
- Next, select Google Drive” as the action channel. Then choose “Upload file from URL”. As the action properties, enter the following:
- for “File URL”, enter
- for “File name”, enter
- for “Drive folder path” enter the path relative to your Google Drive directory where you would like to store the backups, for example you could enter
- for “File URL”, enter
- Give your recipe a name and an optional description, and you’re ready to go!
Now you have setup a fully automized way to backup your WordPress database to your Google Drive folder – without spending any money. And furthermore you might just have learned how to use the awesome power of IFTTT to optimize your workflow. If you have any questions, feel free to post them in the comments below. And I’m also interested in seeing other cool recipes you might have created. Have you been using IFTTT before, are you using it regularly?