
I recently did a major update to website, and staged it on a subdomain (dev.example.com). The live site's media folder was a whopping 15GB - and duplicating all those assets to dev.example.com seemed like a silly idea. Here's my solution.
This functionality is now a complete WordPress Plugin – find it here.
Working on a development or staging site often means duplicating themes, plugins, and even your uploads directory. For small sites, this isn’t a problem — but for sites with huge media libraries, copying all that content can be time-consuming and eat up a lot of disk space.
That’s where our new Dev Media Fallback plugin comes in. Instead of duplicating your entire uploads folder, this plugin allows your dev or staging site to reference media directly from your live site — dynamically, only when the file doesn’t exist locally.
Here’s how it works:
Dynamic media URLs
By hooking into wp_get_attachment_url, the plugin intercepts any media loaded through WordPress functions and replaces missing files with their live-site URL.
Post content fallback
Sometimes images are added directly into page or post content. We hook into the_content to scan for these URLs and update them if the files are missing locally.
ACF fields supported
Advanced Custom Fields are widely used for custom content. Our plugin also scans common ACF field types (text, textarea, WYSIWYG) to ensure all referenced media is available, even if it isn’t duplicated locally.
Smart checks
In every case, the plugin checks if the file exists in the local uploads folder. If it does, it uses the local file. If not, it pulls the file from the live site.
The result: a leaner, faster dev environment that doesn’t compromise on functionality — and without bloating your staging server with hundreds or thousands of images.