caldera_forms_render_assets_minify

Crater Lake in the winter

This filter was added in Caldera Forms 1.5.0

This filter lets you disable Caldera Forms’ minification of CSS and/or JavaScript files. You may wish to do this because you want to provide uncompressed CSS or JavaScript to an optimization plugin. Also, you may be developing or debugging Caldera Forms and find it easier to work with the original files.

Examples

By default Caldera Forms minifies all CSS and JavaScript. If you wish to defeat this and load uncompressed CSS and JavaScript for Caldera Forms you can use the caldera_forms_render_assets_minify filter:

If you want to minfiy JavaScript, but not CSS, take advantage of the second parameter of this filter:

Avoiding Caldera Forms Conflicts With Optimization Plugins

Using Caldera Forms And Autoptimize

If you are using Caldera Forms and you are also Autoptimize to minify assets, you definitely want to use this filter to provide it with unminified CSS and JavaScript or things will probably end poorly.

Using Caldera Forms and WP Rocket

If you are using WP Rocket with Caldera Forms, it should work fine. Please make sure to set your cache time to 10 hours or less. If you are using WP Rocket’s script optimization, it should ignore Caldera Forms’ minified scripts. If you wish to use WP Rocket to optimize script loading, use this filter to disable Caldera Forms’ optimization first.

Where Does This Code Go?

When using WordPress hooks to customize Caldera Forms or other plugins you should not modify the plugin files, or you will lose your changes when you update the plugin. Instead you should create a small plugin to hold the custom code. It's easy, learn how here.

Technically you can add the custom code to your theme's functions.php, but then you will not be able to change your theme and keep these customizations.

Learn More