1.3.0 (superseded — use 1.3.1)
Fixes
Hooks are now registered on plugins_loaded instead of muplugins_loaded.
muplugins_loaded has already fired by the time a plugin in wp-content/plugins/
is loaded, so init() never ran and not a single filter was registered. The
plugin only worked on sites whose mu-plugin included the file manually. It now
works as an ordinary plugin, and that mu-plugin include becomes optional.
Improvements
src, srcset, data-src and data-srcset are rewritten, not just CSS url().
Page builders write media URLs straight into markup and never touch the
attachment API, so those images kept pointing at the local site and 404'd.
srcset candidates are split on their <url> <descriptor> shape so descriptors
survive.
Rewriting is gated behind a new is_local_media_url() helper requiring all three
of: same host as the site, path under the uploads base, and a media file
extension. That last condition matters — SiteGround Optimizer serves combined JS
from wp-content/uploads/, and a naive uploads-prefix test would have proxied a
site's own scripts to production.
Install
Download mg-media-management.1.3.0.zip below and upload via Plugins → Add New → Upload Plugin.
Set the production origin in wp-config.php:
define( 'MG_MEDIA_SYNC_URL', 'https://example.com/' );Full Changelog: v1.1.0...v1.3.0