Hello,
That would depend on how the custom css code was added.
Are you using the standard api to enqueue a CSS file?
https://developer.ww.wp.xz.cn/reference/functions/wp_enqueue_style/
If you are, FVM should merge it together and minify it.
If not, the function you posted will work fine, until you uninstall FVM.
You could replace your return with a function exists to prevent future errors:
if(function_exists('fastvelocity_min_minify_css_string')) {
return fastvelocity_min_minify_css_string($css);
}
That way, it will minify if FVM is available and do nothing if you remove it.
If you don’t do the function exists check… and remove FVM, you will have a Fatal error, since fastvelocity_min_minify_css_string would not exist.
Hi,
I’m not talking about the wp_enqueue_style CSS’s which FVM already handles.
I’m referring to the Custom CSS that’s added via the UI.
https://en.support.wordpress.com/custom-design/editing-css/
This CSS can eventually be post-processed by the ‘wp_get_custom_css’ filter before being outputted.
Given that on my site I have a pretty large “custom CSS” block, minifying it saves several additional KBs, which can’t hurt 🙂
Regarding the function_exists, you’re right. I’ve already added on my site (just after posting this 🙂 )
Ha! The customizer 🙂
I’ll add an option to minify that too in the future, but for now that function would be the way to do it.
Thanks