MMR and WP_CONTENT_URL on different domain (same underlying filesystem)
-
I’m currently wondering how to best go about an issue I’m having with a site where WP_CONTENT_URL is different from the main site URL (same underlying WP install, just static files accessed via a different domain).
In that case, MMR won’t concatenate files because the domain is different from where the plugin is. I temporarily worked around this by changing$this->host = parse_url( $this->host, PHP_URL_HOST );
to$this->host = parse_url( WP_CONTENT_URL, PHP_URL_HOST );
in merge-minify-refresh.php:MergeMinifyRefresh->__construct.
A part of this problem is also within WordPress itself because there is no straightforward way (that I know of) to set a different domain for *all* scripts and styles. I know I can set MMR_CACHE_URL, but there are some scripts and styles I deliberately don’t want processed, but still hosted from the static files domain. What i did was add a WP filter that iterates over all the enqueued scripts and styles and changes the domain before MMR does its thing, and this works nicely as intended with the MMR change above, but I wonder what would be the best solution.
- The topic ‘MMR and WP_CONTENT_URL on different domain (same underlying filesystem)’ is closed to new replies.