How to Connect Your WordPress Media Library to OneDrive
Ever wished that you could store some or all of your WordPress site’s media files in remote cloud storage instead of on your server? There are a lot of benefits to this when it comes to price, convenience, and potentially performance.
In this post, you’re going to learn how to connect your WordPress media library to one specific cloud storage provider – OneDrive. You’ll be able to sync the two together so that any changes in WordPress are automatically reflected in OneDrive and any changes in OneDrive are automatically reflected in WordPress.
This method will not replace the standard WordPress Media Library. Instead, it will add a new feature that lets you work with OneDrive files when needed, but still, retain access to the normal WordPress media library.
Ready to learn how? Here’s how to connect your WordPress media library to Microsoft OneDrive.
How the WordPress – OneDrive Connection Works
Once you follow the tutorial in this post, you’ll get a dedicated OneDrive folder for your WordPress site. Any files and folders inside this dedicated folder on OneDrive will automatically sync with your WordPress site, and you’ll also be able to create and manage folders in OneDrive from your WordPress dashboard.
The sync goes both ways – so any changes in OneDrive are reflected in WordPress, and any changes in WordPress are reflected in OneDrive:
What’s more, you’ll be able to insert images and other files straight from OneDrive into your WordPress content. And remember – you’ll still be able to access your regular media library, so you’re not losing any functionality that you already had.
Ready to get set up? Here’s what you need…
What You’ll Need to Connect WordPress to OneDrive
To connect your WordPress site to OneDrive, you’re going to need a few things.
First, you’ll need a OneDrive account. If you don’t already have one, you can head here to create one. OneDrive gives you up to 5 GB of storage for free. After that, paid OneDrive plans start at $1.99 per month for up to 100 GB of storage.
In addition to your OneDrive account, you’ll need a plugin to help you connect your media library to OneDrive.
For that part of the puzzle, you’re going to use the WP Media Folder plugin, along with its OneDrive addon. In addition to letting you use folders to organize your media library, this plugin also makes it easy to connect to OneDrive. We’ve previously reviewed the WP Media Folder plugin, so you can check out that review to learn more about the core functionality.
To get both the core plugin and the OneDrive add-on, you’ll need the Plugin + Addon plan, which will cost you $59.
Here’s how to set everything up…
1. Install WP Media Folder + Add-on
To get started, install, and activate the core WP Media Folder plugin. Then, run through the short setup wizard to get all the basics out of the way.
Once you’ve done that, you should see a new folder interface when you go to the regular Media tab in your WordPress dashboard:
Then, install and activate the separate WP Media Folder Addon plugin. When you’re finished, you should have two plugins installed and activated:
2. Generate OneDrive Client API Key
Next, you’ll need to generate your OneDrive API key, which is the key that lets you link your WordPress site to your OneDrive account.
To generate this key, you’ll need to create a Microsoft Azure App. While that might sound a little complicated, there’s no reason to be scared, and I’ll show you exactly how it works.
To get started, click this link to head to Azure and sign in using the same credentials that you use for OneDrive. Once you’re signed in, you should be in the App registrations section. Click the New registration button:
Give it a name – like “WP Media Folder”. Then, if you’re using a personal OneDrive account, enter the URL to your WordPress admin dashboard in the Redirect URI box. For example, “https://yoursite.com/wp-admin/”.
Or, if you’re you’re using a OneDrive Business account, enter “https://yoursite.com/wp-admin/upload.php”.
- Personal account – https://yoursite.com/wp-admin/
- Business account – https://yoursite.com/wp-admin/upload.php
Then, click the Register button:
Once Microsoft registers your app, you should see the app dashboard.
In that dashboard, go to the Certificates & secrets area. Then, click + New client secret:
In the popup, enter a description and select Never under the Expires options. Then, click Add:
Keep this page open and readily available because you’ll need it in the next section.
3. Add API Key to WordPress Plugin Settings
Next, head back to your WordPress dashboard and go to Settings → WP Media Folder. Expand the Cloud section and choose OneDrive.
Then, paste the client secret key that you just created above into the OneDrive Client Secret box in the plugin’s settings:
Then, you’ll also need to add the OneDrive Client ID, which you can find in the Overview tab in your Azure account:
Once you’ve added both to your WordPress dashboard, make sure to save your changes to finish the connection:
4. Connect to OneDrive in WordPress
Once you save your changes, you’ll see a new Connect OneDrive button in the WordPress dashboard settings. Go ahead and click that button:
This will take you to a OneDrive authorization screen where you’ll want to accept all the permissions that the app asks for:
And that’s it! You’re now connected.
5. Access OneDrive
Now, when you go to your media library, you’ll see a new OneDrive option that you can access in addition to your regular media library. Just like the regular WP Media Folder interface, you can create your own folders to organize files:
In your OneDrive account, the plugin will create a dedicated folder for your WordPress site, and any folders that you create in your WordPress dashboard will exist inside this one parent folder. Similarly, the plugin only syncs with files inside this folder – it will not pick up other files on your OneDrive account:
If you don’t see files, you can always right-click on the OneDrive option in your WordPress dashboard and choose the option to Run full synchronization:
You can also access your OneDrive files when you’re working in an individual piece of content. For example, you could browse OneDrive to embed an image from your OneDrive account:
In this case, the image file would be loaded from OneDrive’s servers, not your WordPress site’s server.
Another cool thing that you can do is use WP Media Folder’s built-in gallery functionality to create galleries straight from images on OneDrive.
If you’re using the new block editor, you can insert a WP Media Folder block. Then, you can select the images that you want to use from OneDrive:
And then you’ll be able to use the block’s settings to configure how the gallery looks and functions.
That wraps up our guide on how to connect WordPress to Microsoft OneDrive using the affordable WP Media Folder plugin.
Do you have any questions about how to set things up or how the integration works? Ask away in the comments, and we’ll try to help! And again, you can learn more about the WP Media Folder plugin in our full WP Media Folder review.