From 649a9cd10bd224d7c13c6d03df76a8861df09957 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Thu, 23 Apr 2026 18:43:06 +0800 Subject: [PATCH] LiteSpeed Cache: Exclude JS from Combine --- includes/class-convertkit-cache-plugins.php | 24 +++++++++++++++++++ .../PageBlockFormPerformancePluginsCest.php | 6 ++--- .../PageShortcodeFormCest.php | 6 ++--- .../forms/post-types/BlockEditorFormCest.php | 6 ++--- .../post-types/ClassicEditorFormCest.php | 6 ++--- tests/Support/Helper/WPCachePlugins.php | 8 ++++++- 6 files changed, 43 insertions(+), 13 deletions(-) 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