| 开发者 | criandoparaweb |
|---|---|
| 更新时间 | 2026年10月21日 22:12 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
srcset sources, post content, widgets and blocks to the public bucket URL.r2.dev development address cannot do it. The Cloudflare free plan includes 5,000 unique transformations per month; repeat visitors are served from the cache and cost nothing.
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:
wp-config.php and kept out of the database entirely.r2.dev development URL, or, recommended for production, connect a custom domain to the bucket in Cloudflare. Paste that address in Public bucket URL.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.
Yes, as a separate add-on. Everything this plugin does is free and will stay free. CPW R2 Pro adds what stores, agencies and larger sites need: private files with signed URLs for WooCommerce and Easy Digital Downloads, background offload with WP-CLI, Multisite and theme and plugin assets served from R2.
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.
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.
Yes. Since version 1.5.0 it also works with local deletion enabled: when you open an image in the editor, crop it in the Customizer or pick it as the site icon, the plugin copies it back to the server first. Once you save, the edited image is offloaded again and, with local deletion on, removed from the server.
Never. Uninstalling removes only the plugin settings, log and internal post meta. Your bucket is left untouched.
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.
If you turn it on, and there are two ways to do it. Convert on delivery hands the work to Cloudflare, which is the recommended option and is covered in its own question below. Convert to WebP under Offloading does it on your own server instead: 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, and it is the better option. Turn on Convert on delivery under Image optimisation on Cloudflare. Your images are then served through Cloudflare Image Transformations, which converts them to AVIF or WebP per browser and caches the result. Your server never decodes or encodes an image, the originals on the bucket stay as they are, and images already in your library are covered without any reprocessing.
You need a custom domain connected to your bucket and transformations enabled for that zone in Images → Transformations in the Cloudflare dashboard. The r2.dev development address does not go through a zone and cannot transform anything; the settings screen tells you when that is the case.
The Cloudflare free plan includes 5,000 unique transformations per month. A unique transformation is one combination of options applied to one image: the first visitor pays for it and everyone after that is served from the cache, at no cost. Beyond the free allowance Cloudflare charges per thousand. The plugin uses a short ladder of five widths by default to keep that count low, and the cpw_r2_transform_widths filter lets you shorten it further.
Use one or the other, not both. The delivery conversion is the better default: it costs your server nothing, keeps your originals intact and applies to your whole library at once. The upload conversion is for sites without a custom domain on Cloudflare, or for anyone who would rather store the smaller file on the bucket and accept losing the original.
Yes. Give each site a different Path prefix, for example site-a and site-b.
Since version 1.5.0 this is handled for you. Every time a file is sent to the bucket again, its URL gets a new ver value, so browsers and the Cloudflare cache fetch the new content instead of the copy they kept for a year. Files offloaded only once keep their plain URL.
On a custom domain, yes, until their cache expires: deleting an object from the bucket does not touch the copy Cloudflare keeps on the edge. To clear it automatically, fill in Zone ID and API token under Delivery > Cloudflare cache purge. The token needs the Zone > Cache Purge permission only. The plugin then clears the cached copy whenever a file is deleted from the bucket or sent again, and Test cache purge checks the values without purging anything. If Cloudflare times out, limits the requests or has an outage, the files are queued and tried again automatically, waiting longer each time, for about half an hour; a refused token is reported in the Log tab instead of retried. Both values can also be defined in wp-config.php as CPW_R2_CF_ZONE_ID and CPW_R2_CF_API_TOKEN.
Versions before 1.5.0 offloaded an upload before WordPress had created its thumbnails, so only the main file reached the bucket and, with local deletion on, no thumbnail was ever made. Run Send everything again once in the Offload tools tab. It brings back the files whose local copy was deleted, creates the missing thumbnails and sends every size to the bucket.
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.
cpw_r2_flush_page_cache filter turns it off, and the cpw_r2_page_cache_flushed action receives the list of caches cleared, to plug in any other cache.?ver=), in attachment URLs, responsive images and page content. With the one year Cache-Control the old content used to stay in browsers and on the Cloudflare edge. Files offloaded only once keep the URL they have.CPW_R2_CF_ZONE_ID and CPW_R2_CF_API_TOKEN constants for wp-config.php.CPW_R2_Media::versioned_url(), the cpw_r2_purge_urls filter, and the cpw_r2_removed action now passes the removed payload as a second argument.cpw_r2_setting_locked filter marks any setting as managed elsewhere.CPW_R2_Client::presigned_url()), add-ons can register their own tabs on the plugin screen (cpw_r2_admin_tabs and cpw_r2_render_tab_{$slug}), and the Pro panel can be hidden with cpw_r2_show_pro_panel.