Last year I wrote a bit about the WP Offload Media plugin when we were offloading more than 700 GB of files from Macaulay’s Eportfolios to S3. The plugin did the job, but one of the struggles with this plugin was loading the GUI interface for the plugin in the network panel for larger WPMS instances. Macaulay’s Eportfolios has almost 10,000 sites on and when trying to access the plugin’s panel in the network screen it seldom loaded. What’s more, there was no command line interface (CLI) to route around that interference which caused some real frustration.
For another project we’re preparing to offload more than a terabyte of data to S3 for an even larger multisite, so it seemed expedient to explore other plugin options. One of those is the S3 Uploads plugin, which Taylor shared with me a while ago and it seemed high time to give it a go.
Luckily this post is going to be short and sweet because swapping out WP Offload Media with S3 Uploads was dead simple. I just added a few lines to my wp-config.php file:
define( 'S3_UPLOADS_BUCKET', 'files.bavatuesdays.com/wp-content' ); define( 'S3_UPLOADS_REGION', 'us-east-1' ); // the s3 bucket region // You can set key and secret directly: define( 'S3_UPLOADS_KEY', 'yourkeygoeshere' ); define( 'S3_UPLOADS_SECRET', 'yoursecretkeygoeshere' );
I also added the custom URL for my offloaded files I had previously setup using this additional line in wp-config (you can read more about setting up the custom domain for files in Cloudflare in this post):
// Define the base bucket URL (without trailing slash)
define( 'S3_UPLOADS_BUCKET_URL', 'https://files.bavatuesdays.com/wp-content' );
After that, I deactivated the WP Offload Media plugin and activated the S3 Uploads plugin. I made sure to verify that my S3 settings are working with this CLI command:
wp s3-uploads verify
Once verified, I was good to go; it really doesn’t get much easier than that. Truly a one-to-one replacement for the WP Upload Media plugin.
Now to be fair, I had all my media offloaded to an S3 bucket already, so I could skip that step which can take some time. But if you do need to move your media from your WP instance to S3, the S3 Uploads plugin has a command for that:
wp s3-uploads upload-directory /path/to/uploads/ uploads
Or for my blog it would be:
wp s3-uploads upload-directory /var/www/webroot/ROOT/wp-content/uploads/ uploads
The plugin contains several useful options for managing permissions, cache control, offline development, and token sessions. Additionally, it supports various S3 endpoints beyond AWS, such as Minio, Digital Ocean’s Spaces, and Scaleway to name a few. The S3 Uploads plugin has much of the flexibility and power of WP Media Uploads without the interface loading issues that bogged us down with Macaulay’s instance. Part of the reason for this is everything is done via CLI or defined in the wp-content.php file, so there’s no GUI interface to speak of for this plugin. That could be a deal breaker for some, but given the plugin is actively developed and as of now free to use it certainly makes for a compelling drop-in replacement for our current and future S3 offloading setups.
Actively Developed – the two most golden words in the GitHub, plugin dev universe.
Indeed!