WordPress is by far one of the best CMS in the world. As much as WordPress has its fan following around the globe, it is equally vulnerable to a vast market of hackers. Even though you have installed the best WordPress security plugin, the attackers are smart enough to find a way around to hack into your website.
Just a few weeks back, WordFence published a report on defacement campaigns. It contains a detailed analysis of a 26% growth in defacement in just 24 hours. The total number of defaced pages for all the campaigns, as indexed by Google, grew from 1,496,020 to 1,893,690 in just a matter of time.
This proves that there is no way that we can confirm ourselves as protected. Considering all these circumstances, what, if your site has also been compromised?
To avoid hacking hassles, one way is to keep a ready backup of your website. You can achieve it by simply following two easy ways to have a backup:
- Local backup: All the backup files will be on your hosting provider.
- Remote/Offsite backup: All the backup files are located at a third party secure remote storage. Like: Amazon S3, Dropbox and Google Drive.
In my opinion, having an offsite backup is a recommended option because even if you are facing any issues with your hosting provider, you can still be able to restore your backup from the remote/offsite backup location.
In today’s article, I will discuss how one can create a WordPress backup on Google Drive, as well as how they can restore it for later use.
WordPress plugin repository offers a variety of WordPress backup plugins. However, today, I am going to use UpdraftPlus. It is one of the most popular backup plugins with an actual installation of more than a million. UpdraftPlus offers prominent features for creating an efficient backup of your WordPress website and send it to your Google Drive automatically in certain time intervals.
How to Install UpdraftPlus Plugin
In this section, I will guide how you can add and install UpdraftPlus to your WordPress website. First off, Login to your WordPress Admin Dashboard and navigate to Plugins -> Add New. Search for UpdraftPlus, install and activate it.
In the settings option located on the left side of your WordPress dashboard, navigate to Settings -> UpdraftPlus Backups.
That’s how the UpdraftPlus personalized dashboard looks like at the back-end.
Here you can find some tabs.
The Current Status Tab:
The Current Status Tab contains three buttons:
- Backup Now: It will perform a backup of your site. You can select either the backup should be sent to Google Drive or not. We will cover this further in detail later on in the next steps.
- Restore: If you already have a backup of your website, you can easily restore it from here.
- Clone/Migrate: It is a premium feature offering cloning and migrating option.
The Existing Backups Tab:
This tab enables you to restore your backups in two different ways, locally or remotely. All of them will be listed and controlled from here.
The Settings Tab:
The settings tab allows you to configure the plugin. Following are some of the options that can be set. Let’s discuss each of them, one by one.
- Files and Database Backup Schedule
The frequency of creating backups is controlled from here. UpdraftPlus have few default time intervals to have a backup. It also allows you to create a backup manually. In the image below, the number of scheduled backup is set to 2. However, you can set as many backups at a time as you want. Just, increase the counter to the number of your choice.
- Choose Your Remote Storage
UpdraftPlus allows you to have a backup on many remote storages. Since this article focuses on creating a WordPress backup on Google Drive, hence we are going to select the Google Drive icon.
As soon as you choose the “Google Drive” option, new text fields will automatically appear on your screen. It will ask you for Google Drive Client ID and Secret.
I understand that you must be feeling a bit confused but don’t worry, UpdraftPlus just wants to access your Google Drive to send backups. To connect UpdraftPlus with Google Drive, it needs credentials, and here you can add yours.
Backup WordPress Website to Google Drive
When it comes to backing up your WordPress site to Google Drive, you will have to follow a list of steps. These steps are listed below:
Get Client ID and Secret
First of all, get a Client ID and Secret. To do so, navigate to Google API and create a new project.
Name your project. For example, here we have named the Project “SourceWP” and hit Create.
In just a few seconds, a new project will create itself. Once done, you will be directed to the list of Google APIs. In Google Apps APIs, click on Drive API.
Click on Enable on the next screen that pops up.
As we have already mentioned above, UpdraftPlus needs credentials to connect with Google API, so you need to create your credentials in the API Manager.
From the left pane, navigate to Credentials, then click on the tab 0Auth consent screen. Name the product as per your choice, and at the bottom of the screen click on Save.
On the next screen, we are going to create credentials. Click on the small drop-down arrow and select 0Auth client ID.
Copy the above URL, and paste it in the Authorized Redirect URIs as directed in the image below.
Don’t get confused with my URLs. I have tested the plugin on an optimized and Managed WordPress Hosting that provides staging URLs to test applications before making it live.
Anyhow, once configured correctly. Click on the Create button at the bottom of the screen. It will create and display client ID and secret. Now you can add these credentials in your UpdraftPlus settings tab.
Copy and paste them one by one in the relevant text fields in the UpdraftPlus settings tab.
Also, you can find a Google Drive Folder on the settings page. By default, it is set to UpdraftPlus. However, if you wish to rename it to something else, then you will have to get the premium version of UpdraftPlus.
UpdraftPlus allows you to include or exclude directories that need to be backed up. Mark with your requirements.
It is also noticeable that UpdraftPlus does not backup the core files of WordPress. This reduces the file size of the backup. You can always download the core files from WordPress.org.
If you want to get an email once a backup process is done. Mark the checkbox in email tab. Scroll down a bit and click Save Changes at the end of the screen. A new pop-up will appear, asking to authorize the remote storage. Follow the link and click on Allow.
Let’s Take an Example
To backup a website, navigate to UpdraftPlus Current Status tab and click on Backup Now. A new popup will appear asking you, which directories you want to backup.
As you can see, I have marked the checkbox where it says “send this backup to remote storage”. It will take few moments to backup everything and send it to our Google Drive.
Just to verify, navigate to existing backups tab and you will see our newly created backup is already present there.
Let’s check it on our remote storage. Go to your Google Drive and get into the folder named as “UpdraftPlus”. This is how your folder looks like:
Restore WordPress Backup
To restore a backup. From UpdraftPlus dashboard, navigate to Existing Backups. All available backups are listed here. Click on the Restore button on the particular backup that you want to restore. It will ask you which directories you want to restore. Choose as per your preference and click on the Restore button at the bottom of the popup.
And you are done! So that’s all there is to it :)
Hopefully, this article was of considerable help in guiding one how you can send your WordPress website backup to a remote storage such as Google Drive. You can also choose any other offsite location of your choice, UpdraftPlus offers you a number of options. You can follow the same exact steps discussed above for other remote storages offered by UpdraftPlus.
But…. Don’t rely on backups only! It is always suggested to follow WordPress security tips. The backup is the last option you can do after getting hacked. It’s better to use other methods to make your WordPress website’s highly secure.
If you have any query, feel free to discuss via the comments section below. I will be waiting for your feedback.