How to Connect Your WordPress Media Library to Google Drive
Looking for an easy way to connect the WordPress Media Library to Google Drive?
In this article, I’m going to show you a simple way to sync your WordPress Media Library with Google Drive in both directions. That is, when you add a file to your WordPress Media Library, that file will show up in Google Drive. But it also works in the other direction – when you add a file to Google Drive, it will show up in your WordPress Media Library.
You’ll be able to insert and load files directly from your server by importing them. Or, you can also embed them directly from Google Drive’s servers if that fits your needs.
And oh yeah, the plugin that you’ll be using also gives you access to folders in your Media Library, which makes it even easier to stay synced with Google Drive.
In this article, I’ll explain what you need and show you step-by-step how to set everything up.
What You Need to Connect the WordPress Media Library to Google Drive
To connect your WordPress Media Library to Google Drive, you can use the WP Media Folder plugin, which we’ve previously written about here at WPLift. If you want to learn more about the plugin, you can check out our full WP Media Folder review. But here’s the basic gist of things…
As the name suggests, the core plugin focuses on giving you drag-and-drop folders in the WordPress Media Library. You can use these folders to organize your files and easily move files around using drag-and-drop (just like you do on your computer). You can also upload files via FTP and the plugin can help you import them and sync the file structure.
Then, with an add-on, WP Media Folder can also help you sync your files and folders to Google Drive and other platforms like Dropbox or Microsoft OneDrive. We actually previously wrote a tutorial on how to sync the WordPress Media Library with Microsoft OneDrive.
It also has some other useful features, like letting you include external videos (e.g. YouTube) as items in your Media Library for easy recall/insertion. Again, check out our full review if you want to learn more.
WP Media Folder is a premium plugin. So to follow this tutorial and set everything up, you’ll need to purchase both the core plugin and the cloud add-on. This costs just $59 and lets you use the plugin on unlimited sites.
How to Connect Your WordPress Media Library to Google Drive
Now, I’ll show you step-by-step how to connect your Media Library to Google Drive using WP Media Folder.
1. Install WP Media Folder and Addon
To get started, you’ll want to install both the core WP Media Folder plugin and the addon, which is what gives you access to the cloud integrations.
At this point, your Media Library will have folders – feel free to play around with it if you want. Then, keep on reading to learn how to connect all those folders to Google Drive.
2. Create a Google App to Generate Client ID/Secret API Keys
Next, you need to generate the API key that lets you connect your WordPress site to Google Drive.
Unfortunately, Google makes it a little complicated to give WordPress access to the files in Google Drive. This is good because it makes your Google Drive information secure and ensures that no third-party has access, but it does mean you’ll need to take a few extra steps.
Specifically, you’ll need to create your own Google App to generate the Client ID and Client Secret keys that you need. I know that might sound slightly intimidating, but it’s really just a matter of clicking some buttons and entering a few pieces of information, like the URL of your site.
However, there are a lot of buttons to click. So rather than trying to reinvent the wheel, I’m just going to link you over to the developer’s detailed documentation. It showcases every single step and the developers keep it updated (which is helpful if Google makes any changes to its interface).
Once you go through the process, Google should give you two pieces of information:
- Your Client ID
- Your Client Secret
Keep this info handy because you’ll need it in the next step:
3. Add Client ID/Secret to Plugin’s Settings
Now, you need to add the keys that you just generated to the WP Media Folder settings in your WordPress dashboard.
To do that, go to Settings → WP Media Folder. Then, scroll down to the Cloud section in the JoomUnited sidebar. Now, you need to enter/choose four things:
- Drive type – to connect to your own personal account, choose My Drive. If you’re using Google Workplace (G Suite) and want to connect to a shared team account, then choose Shared drives.
- Media link type – choose what permissions to use when you insert media from Google Drive (if you decide to do so – you can also host it locally). If you choose Public link, WP Media Folder will automatically generate a publicly-accessible link for that file. If you choose a Private link, it will keep the original access rights for that file (e.g. only accessible to certain users).
- Google Client ID – paste in the Client ID from the previous step.
- Google Client Secret – paste in the Client Secret from the previous step.
Then, click Save Changes.
Once you’ve done that, click the Connect Google Drive button in the top-right corner:
This will open the standard Google authorization process – much like you’re using Google to sign up/log in to a website. Essentially, you’re giving the app that you created in the previous step permission to connect WordPress to Google Drive:
Go through the various prompts and choose the options to allow your app access to your Google Drive account.
Once you complete the process, your WordPress site should be connected to Google Drive. Time to have some fun now!
4. Access Google Drive in Your Media Library
Now, when you go to the WordPress Media Library, you should see a new Google Drive option along with the files on your WordPress site’s server.
Right now, there’s nothing in there, but you can fix that by uploading some files either from your WordPress dashboard or your Google Drive account:
Here, I’ve uploaded the files from my WordPress dashboard into a sub-folder that I created on Google Drive:
Now, when I go to Google Drive, I also see those files, also in the same sub-folder:
You could also create a new child folder in Google Drive and add some images there. Those files/folders will then appear in your WordPress dashboard.
By default, WP Media Folder syncs your WordPress site with Google Drive every five minutes. However, you can adjust this to be more or less frequent by going to Settings → WP Media Folder → Cloud → Synchronization and changing the Sync periodicity value.
5. Insert Content from Google Drive
In addition to browsing files from Google Drive, you also might want to insert them into your WordPress content.
Again, you have two options here. You can either:
- Insert the file directly from Google Drive. That is, it will load from Google’s servers.
- Import the file to your WordPress Media Library and then insert it. This way, it will load from your WordPress site’s server.
If you opt for the second approach, you would first import the file. Then you would locate it in the folder that you imported it to on your own server.
Connect WordPress Media Library to Google Drive Today
If you want to connect your WordPress Media Library to Google Drive, WP Media Folder offers a really slick implementation that lets you sync in both directions:
- Changes that you make in WordPress will automatically show up in Google Drive.
- Changes that you make in Google Drive will automatically show up in WordPress.
That, combined with the folders and many other useful features, opens up some really nice workflow opportunities and creates a much more user-friendly media management experience for yourself or your clients.
If you want to get started with the Google Drive feature, purchase the full WP Media Folder license for just $59.