diff --git a/src/core.cls.php b/src/core.cls.php index 1b4ef433c..afa6f44ea 100644 --- a/src/core.cls.php +++ b/src/core.cls.php @@ -183,12 +183,6 @@ public function init() $this->cls('Admin'); } - // Show add/save widget form data - if ($this->cls('Router')->esi_enabled()) { - add_action('in_widget_form', array($this->cls('Admin_Display'), 'show_widget_edit'), 100, 3); - add_filter('widget_update_callback', __NAMESPACE__ . '\Admin_Settings::validate_widget_save', 10, 4); - } - if (defined('LITESPEED_DISABLE_ALL')) { Debug2::debug('[Core] Bypassed due to debug disable all setting'); return; diff --git a/src/esi.cls.php b/src/esi.cls.php index 6b46ef406..3e7e9bb4a 100644 --- a/src/esi.cls.php +++ b/src/esi.cls.php @@ -45,11 +45,19 @@ class ESI extends Root */ public function init() { + $esi_enabled = $this->cls('Router')->esi_enabled(); + + if ($esi_enabled) { + // Show add/save widget form data + add_action('in_widget_form', array($this->cls('Admin_Display'), 'show_widget_edit'), 100, 3); + add_filter('widget_update_callback', __NAMESPACE__ . '\Admin_Settings::validate_widget_save', 10, 4); + } + /** * Bypass ESI related funcs if disabled ESI to fix potential DIVI compatibility issue * @since 2.9.7.2 */ - if (Router::is_ajax() || !$this->cls('Router')->esi_enabled()) { + if (Router::is_ajax() || !$esi_enabled) { return; } diff --git a/tpl/esi_widget_edit.php b/tpl/esi_widget_edit.php index 987fdb6ed..467ef4340 100644 --- a/tpl/esi_widget_edit.php +++ b/tpl/esi_widget_edit.php @@ -72,7 +72,7 @@
- +