diff --git a/includes/class-convertkit-cache-plugins.php b/includes/class-convertkit-cache-plugins.php index bbb71b688..e777f560f 100644 --- a/includes/class-convertkit-cache-plugins.php +++ b/includes/class-convertkit-cache-plugins.php @@ -67,6 +67,10 @@ public function __construct() { add_filter( 'convertkit_output_script_footer', array( $this, 'litespeed_cache_exclude_js_defer' ) ); add_filter( 'convertkit_resource_forms_output_script', array( $this, 'litespeed_cache_exclude_js_defer' ) ); + // LiteSpeed: Exclude Forms from JS optimization. + add_filter( 'convertkit_output_script_footer', array( $this, 'litespeed_cache_exclude_js_optimize' ) ); + add_filter( 'convertkit_resource_forms_output_script', array( $this, 'litespeed_cache_exclude_js_optimize' ) ); + // Perfmatters: Exclude Forms from Delay JavaScript. add_filter( 'convertkit_output_script_footer', array( $this, 'perfmatters_exclude_delay_js' ) ); add_filter( 'convertkit_resource_forms_output_script', array( $this, 'perfmatters_exclude_delay_js' ) ); @@ -156,6 +160,26 @@ public function litespeed_cache_exclude_js_defer( $script ) { } + /** + * Disable JS Optimization on Kit scripts when the LiteSpeed Cache Plugin is installed, active + * and its "JS Combine" setting is enabled. + * + * @since 3.3.1 + * + * @param array $script Script key/value pairs to output as