URL rewriting
URL rewriting serves your offloaded media from your CDN. WordPress keeps the original local addresses in the database; WP Media Cloud swaps them for CDN addresses as each page is built. Nothing stored is changed, so turning rewriting off, or deactivating the plugin, returns every address to local.
How it works#
WP Media Cloud filters the WordPress functions that produce media addresses, such as wp_get_attachment_url(), wp_get_attachment_image_src() and wp_calculate_image_srcset(). When the attachment is offloaded, the address that comes out points at your CDN.
Addresses saved as text inside post content are switched too. They are matched in every form they are saved in: https://, http:// (for example on a site that moved to https) and //, with or without www, and JSON-escaped addresses that page builders store (https:\/\/).
Only files that are in your bucket are switched. A file that is not offloaded yet keeps its local address until it is, so nothing breaks while a bulk offload is still running.
What it covers#
- Featured images, images in the block and classic editors, and galleries
- Page builder output, including image addresses that builders save as plain text
- Images in custom fields (ACF, Meta Box, JetEngine, Pods and others)
- WooCommerce product images and BuddyBoss media
srcsetattributes and every thumbnail size- The Media Library and media picker: the File URL shows the CDN address
- Kadence theme backgrounds, header and footer HTML, Kadence Blocks CSS backgrounds, Kadence headers and hooked elements, Conversions popups and Kadence Slider (see Kadence)
- Files offloaded under a path prefix, or imported from another offload plugin with a
wp-content/uploads/prefix: the exact key in the bucket is used
What it doesn’t cover#
- Image addresses written into theme template files (PHP or HTML in the theme folder)
- Content that a plugin prints without passing it through WordPress content filters
- Files outside
wp-content/uploads, such as theme and plugin images. For CSS, JavaScript and fonts, see Theme and plugin assets - Font files in the Media Library, while Serve fonts from your site is on: they are not offloaded and load from your site. See Serve fonts from your site
- Addresses on another domain, such as an old domain from before a migration, or another offload plugin’s CDN
For addresses saved in the database, the URL Replace tool can make the change permanent.
Turning it on or off#

- Go to Media Cloud > Settings and find the Offload Behaviour card.
- Switch Rewrite URLs on or off. It is on by default.
- Click Save Settings.
Which address is used#

The CDN address comes from the CDN card for your storage provider in Media Cloud > Settings: your pull zone, CDN resource, custom CDN URL, or the bucket’s own address when Direct Bucket is selected. The file’s key in the bucket is added to it, for example https://cdn.example.com/2026/10/photo.jpg.
Changing the CDN takes effect on the next page load. Click Update all media URLs under Apply to Existing Media in the same card, then clear your page cache.
Deactivation#
Deactivating the plugin stops rewriting straight away, and WordPress goes back to local addresses. If local copies were removed, those addresses return 404 errors, although the files are still in your bucket.
To stop using WP Media Cloud:
- Turn off Remove local files.
- Download your files back to the server with Download All to Server on the Dashboard, or
wp wpmc restore. - If you used the URL Replace tool, run it again with CDN URLs back to local, or undo the run.
- Check a few pages, then deactivate.
If images don’t load from the CDN#
| Cause | Fix |
|---|---|
| The file is not offloaded | Run Offload All Media on the Dashboard, or check the failed list there |
| Rewrite URLs is off | Turn it on in the Offload Behaviour card |
| A page cache is serving old HTML | Clear your caching plugin, host and CDN page caches |
| The address is in a theme template or on another domain | Edit the template, or use the URL Replace tool for addresses saved in the database |
More checks: URL rewriting not working.