Rewrite WP-Minify URLs for CSS and JS Offloading

If you want to offload your combined and minified javascript and CSS files to a separate domain or a content delivery network (CDN), WP-Minify provides you with a handy set of filters (place this in your theme’s functions.php):

add_filter('wp_minify_js_url', 'offload_minify_js_css');
add_filter('wp_minify_css_url', 'offload_minify_js_css');

function offload_minify_js_css($url) {
	return str_replace('', '', $url);

Never lose a single business lead or enquiry again! Get my latest plugin Storage for Contact Form 7 now!

Buy now for only $19 →


  1. Mike Hudson says:

    Just thought I’d let you know I appreciate you taking the time to post this – I was close (using pre_replace as opposed to str_replace) but your solution works a treat.

  2. Sohail Amir says:

    I’m so glad you posted this! The W3 Cache plugin really wasn’t doing a good job and the CDN off linker plugins weren’t making any difference. This little bit of code makes a huge difference so thanks a load.

Leave a Reply