Description
CPW Media Offload for Cloudflare R2 copies your WordPress Media Library to a Cloudflare R2 bucket and rewrites the media URLs of your site so visitors download images, videos and documents from Cloudflare instead of your web server.
The Cloudflare R2 free tier includes 10 GB of storage and, when the bucket is served through a custom domain, no egress fees. That makes it a practical way to keep a small hosting plan fast: your server stops sending megabytes of images on every page view and stops filling its disk with thumbnails.
What it does
- Uploads new media, and every generated thumbnail size, to your R2 bucket.
- Optionally deletes the local copy after a successful upload, so the uploads folder stops growing.
- Rewrites attachment URLs,
srcsetsources, post content, widgets and blocks to the public bucket URL. - Bulk tool that offloads an existing library in small batches, with progress and a stop button.
- Copy files back to the server at any time, per file or for the whole library.
- Usage bar tuned for the 10 GB free tier, measured directly on the bucket.
- Optional WebP conversion on upload, so the smaller file is what uses your storage allowance.
- Cloudflare R2 column and per file actions inside the Media Library, including sending a changed file again.
- Rebuild tool that restores the offload index by checking the bucket, without uploading anything.
- Activity log so upload or permission problems are visible without server access.
Page builder and theme compatibility
Media URLs stored inside page builder data are rewritten as well, so background images, galleries and sliders keep working after an offload:
- Elementor and Elementor Pro, including generated CSS files and background images.
- Divi, Beaver Builder and WPBakery Page Builder.
- Block themes, classic themes, the block editor and any theme that uses the standard WordPress media functions.
Elementor’s CSS cache is cleared automatically after an offload so its generated files point at the new URLs.
Languages
The plugin is fully internationalised. Translations are provided through translate.wordpress.org, where Brazilian Portuguese and any other language can be contributed.
Security
- The secret access key is encrypted with your WordPress security keys before it is stored.
- Credentials can be defined as constants in
wp-config.phpand kept out of the database entirely. - Every form is protected with nonces and capability checks.
- No third party SDK is bundled: requests are signed with AWS Signature Version 4 and sent through the WordPress HTTP API.
External services
This plugin connects to the Cloudflare R2 storage service, which is the whole purpose of the plugin. It does not connect to any other external service and it sends no analytics or telemetry anywhere.
Cloudflare R2 (S3 compatible API)
- When: whenever a file is offloaded, restored, deleted or listed, and when you use the Test connection or Recalculate storage usage buttons.
- Where:
https://<your-account-id>.r2.cloudflarestorage.com(or the EU or FedRAMP jurisdiction endpoint you select, or a custom endpoint you enter). - What is sent: the media files you choose to offload, their file names and content types, your R2 access key id, a request signature generated from your secret access key, and a user agent string containing the plugin version and your site address.
- What is received: the storage responses of the service, including object listings and sizes used by the usage bar.
Files served to your visitors are additionally requested from the public bucket URL you configure (an r2.dev address or your own custom domain).
Cloudflare terms of service: https://www.cloudflare.com/terms/
Cloudflare privacy policy: https://www.cloudflare.com/privacypolicy/
Screenshots




Installation
- Install and activate the plugin.
- In your Cloudflare dashboard create an R2 bucket and an R2 API token with Object Read and Write permission.
- Go to Media Cloudflare R2 and fill in the account id, access key id, secret access key and bucket name.
- Click Test connection.
- Give the bucket a public URL: either enable the
r2.devdevelopment URL, or, recommended for production, connect a custom domain to the bucket in Cloudflare. Paste that address in Public bucket URL. - Open the Offload tools tab and run Start offloading to move the existing library.
- Back in Settings, enable Serve media from R2.
- Only after checking that your site renders correctly, enable Delete the local copy after a successful upload to free disk space.
FAQ
-
Do I need a paid Cloudflare plan?
-
No. The R2 free tier includes 10 GB of storage per month plus a monthly allowance of read and write operations, which is enough for most small and medium sites. The plugin shows how much of that allowance your media uses.
-
Does it work with Elementor?
-
Yes. Beyond the standard WordPress media functions, the plugin rewrites the URLs stored inside Elementor documents, so widgets, galleries and background images all point at Cloudflare. The Elementor editor keeps working with local paths, and Elementor’s CSS cache is cleared after an offload.
-
Will my media break if I deactivate the plugin?
-
No, as long as the local copies still exist: URLs simply go back to your server. If you enabled local deletion, run Copy everything back to the server in the Offload tools tab before deactivating.
-
Can I keep using the WordPress image editor?
-
Yes while the local copy is kept. With local deletion enabled, use Copy back to server on that file first, edit it, and it will be offloaded again.
-
Does it delete my files from R2 when I uninstall the plugin?
-
Never. Uninstalling removes only the plugin settings, log and internal post meta. Your bucket is left untouched.
-
I deleted the plugin and lost the record of what was offloaded. What now?
-
Your files are still on the bucket: the plugin never deletes them. Go to the Offload tools tab and run Rebuild the index, which checks every attachment against the bucket and restores the record without uploading anything. To stop it happening again, keep the setting Keep the settings and the offload index enabled, which is the default from version 1.1.0. Note that deleting a plugin runs its clean up routine, while updating one does not.
-
Does the plugin convert my images to WebP?
-
Only if you turn it on. With the option enabled, JPEG and PNG uploads are converted before the thumbnails are generated, so every size is WebP and the smaller file is what counts against your storage. GIFs are never converted so animations survive, and an image is only replaced when the WebP version really is smaller. It applies to new uploads: images already in the library are left as they are.
-
Yes. Give each site a different Path prefix, for example
site-aandsite-b. -
What happens to files that fail to upload?
-
They are flagged and skipped so the bulk tool can continue. The reason is recorded in the Log tab, and Queue failed files again puts them back in line.
Reviews
Contributors & Developers
“CPW Media Offload for Cloudflare R2” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “CPW Media Offload for Cloudflare R2” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.2.1
- Removed the Plugin URI header, which pointed at a page that does not exist yet.
- Translations are no longer bundled: they come from translate.wordpress.org.
1.2.0
- The plugin is now called CPW Media Offload for Cloudflare R2. Only the name, the slug and the text domain changed: your settings, your offload index and your files on the bucket are untouched.
1.1.1
- Every credential field on the settings screen now has a “Where to find this in Cloudflare” panel showing the exact click path in the Cloudflare dashboard, including a warning that the secret access key is only ever displayed once.
1.1.0
- Deleting the plugin no longer erases your settings and offload index by default. A new setting controls it, and files on the bucket were never touched to begin with.
- New tool that rebuilds the offload index by checking the bucket, for libraries whose index was lost.
- New “Send to R2 again” action, per file and in bulk, for files that changed after being offloaded.
- Optional WebP conversion of JPEG and PNG uploads, with a quality setting. Conversion runs before the thumbnails are generated, GIFs are left alone, and the original is only replaced when the WebP version is actually smaller.
1.0.1
- Translations are now loaded without load_plugin_textdomain(), which is discouraged since WordPress 4.6. Language packs from translate.wordpress.org keep taking precedence over the bundled files.
- The attachment lookup query now passes its meta key as a prepared placeholder.
- Declared compatibility with WordPress 7.1.
1.0.0
- First public release.
- Offload of new uploads and of existing libraries to Cloudflare R2.
- URL rewriting for attachments, srcset, post content and page builder data.
- Elementor, Divi, Beaver Builder and WPBakery compatibility.
- Multipart uploads for large files, bulk tools, usage meter and activity log.
- Ready for translation through translate.wordpress.org.
