Backup WordPress on Google Drive

Backup WordPress on Google Drive

WordPress is the most popular CMS on the internet and powers a significant portion of the web. Unfortunately, this also means that WordPress powered websites are prime targets for attackers. While you could take steps for securing WordPress sites, there is always a high chance that your site will get hacked! In such cases, the best recourse is the backup of your site.

In practice, there are ways of backing up the WordPress site. The first way is to backup the website on the local servers. The second option is to backup the website to cloud storage solutions such as Google Drive, Amazon S3 or Dropbox.

In this article, I will guide you through the process of backing up WordPress websites to Google Drive. A very important issue in this regard is the high number of backup plugins in the official WordPress Repository. To ease the stress in this regard, I will use UpdraftPlus, a very popular plugin with a million plus active installations.

Install UpdraftPlus Plugin

Login to your WordPress Admin Panel and navigate to Plugins >> Add New. In the top right, search for UpdraftPlus, install and activate it.

Once activated, navigate to Settings >> UpdraftPlus Backups. I will explain the function of each tab in some details:

Current Status
The default dashboard of UpdraftPlus contains three buttons:
1. Backup Now: Start the backup process.
2. Restore: Restore the previous backup.
3. Clone/Migrate: Only available in the premium version, this will clone/migrate the website.

Existing Backups
There are two types of backup:
1. Local: The backup files are stored on the local web hosting.
2. Remote: Backup files are located on other platforms, such as Google Drive, Amazon S3, Dropbox.

This tab lists all the available local backups. If the backup files are not stored locally, and you wish to restore data from the remote storage solution, click on Rescan remote storage. UpdraftPlus will pull these files from the remote storage and then start the restore process.

Settings
UpdraftPlus allows you to customize and configure settings. Here are severals tabs that need to be set:

Files and Database Backup Schedule
UpdraftPlus breaks down the backups into two instances, Files, and Database. It allows you to schedule your backups, either manually or automatically, at certain times. The second counter represents how many backups you want to retain. As you can see from the following screenshot, it will keep only the last two backups.

Choose a Remote Storage
UpdraftPlus supports several remote storage solutions. Since I am focusing on Google Drive, I will highlight Google Drive related settings. Click the Google Drive icon, and it will present the required fields that UpdraftPlus needs to connect with Google Drive.

Google Drive Client ID: This is the ID that will be generated in the second step.
Google Drive Client Secret: The secret key for the above ID.
Google Drive Folder: In the basic version of UpdraftPlus, this is a default folder in the Google Drive. You need the premium version to rename the folder.
Authenticate with Google: The last step will be to authenticate UpdraftPlus with Google.

 

Backup WordPress Website to Google Drive

The process of backing up WordPress sites to Google Drive comprises of several steps:

Get Google Drive Client ID and Secret
Go to this link, Click Create Project and name the project anything you want.

The process of creation of the project will take several seconds. Once done, you will see the list of all Google console API. Under Google Apps APIs, select Drive API.

You will be taken to the next screen. Here you will be asked to Enable the newly created Drive API, allowing UpdraftPlus to access Google Drive.

However, UpdraftPlus needs credentials to use the Drive API. From the left pane, navigate to Credentials >> 0Auth consent screen and give a relevant name. Click the Save button near the bottom of the screen.

A new screen will pop-up, ask you to create credentials. Click the small drop-down arrow and select 0Auth Client ID.

At this point, I will create client ID. Select web application at the next screen and name it.

Under the restrictions tab, two text fields might confuse you. I will now explain what to enter in each field:
Authorized JavaScript Origins: The main URL of the website. Since I am using a staging URL, my URL is quite long.
Authorized redirect URIs: This URL can be found at UpdraftPlus. Go back to the UpdraftPlus dashboard to the screen where you selected Google Drive and scroll down a bit. You will get the URL just above where it says “Google Drive Client ID”.

Once everything is configured perfectly, click on the Create button. A new pop-up will appear, displaying client ID and Secret (check the screenshot below):

 

Copy the above credentials one by one and paste them in the UpdraftPlus dashboard.

Select Files for Backup

UpdraftPlus allows you choose which directories will be included in the backup. By default, the plugin excludes several local backup directories.

Note: To minimize the size of the backup file, UpdraftPlus does not backup the core files of WordPress.

To get an email every time UpdraftPlus executes a backup, check the box under the Email tab.

The last step is to click the Save Changes at the bottom of the screen. Another popup will appear, asking you to authenticate the remote storage. Follow the link to authorize the access. Click the Allow button.

UpdraftPlus is now connected with Google Drive. To verify this, go to the Google Drive and verify that there is a new folder named UpdraftPlus.

Now, all the remote backups will be created in this folder.

A Real World Example

I will now present a real world scenario that backs up a WordPress website manually.
Go to the UpdraftPlus dashboard. Under the Current Status tab, click the Backup Now. A new pop-up will appear, asking what you want to backup. By default, it will backup everything. Click on (…) to choose from the available options.

If you do not mark the check box for the remote storage. UpdraftPlus will create a backup locally (on the hosting for the website). When creating a remote backup, it will send the backup to the Google Drive.

Depending on the size of the backup file, the process could take some time. Once the process finishes, go to the Existing Backups tab to check the list of all previous backups.

 

Just to verify that this backup is on the remote storage, head to the Google Drive and go into the UpdraftPlus folder. All backup files will be listed:

Restore WordPress Backup Files

To restore a backup, click the Restore button under the Current Status tab. You will be asked to select the directories to be restored.

Advanced Tools
UpdraftPlus also offers several advanced tools for power users.

The Last Words

It is always recommended that you first find a secure WordPress hosting and then also carry out the offsite backup. This backup ensures that in the case of a disaster, you have a secure copy of the site that could be instantly restored.

If you have any questions, feel free to leave a comment below!

Author Bio:

Mustaasam Saleem

Mustaasam Saleem is a WordPress Community Manager at Cloudways – A Managed WordPress Hosting Cloud Platform, where he actively works in learning and sharing knowledge with the WordPress Community. When he is not working behind his computer screen, you can find him playing squash with his friends, or defending in Football and listening to music. Connect with him on Twitter:  or Email.

This Post Has 7 Comments

  1. Thanks i was not aware of this. It is good to take the backup of your wordpress site for future uncertainity.
    Thank you for sharing

    1. Thanks Kaustubh for your kind words. Keep visiting 🙂

  2. This looks very promising! I didn’t know you could do backups through Drive like this. Thank you so much for sharing this plugin setup!

  3. I spent a great deal of time to locate something like this

  4. NO,
    This plugin cannot be an alternative of duplicator.

  5. Hello,
    Thanks for sharing this awesome and helpful article with us.

    I am a big fan of wordpress. It is working fine with me. We are using many websites by wordpress. But some days ago I lost my data for a little mistake but now I know how to keep backup and restore again. Thank you so much!

Leave a Reply

Close Menu