diff --git a/src/esi.cls.php b/src/esi.cls.php index fa9aa45ee..62e2d353f 100644 --- a/src/esi.cls.php +++ b/src/esi.cls.php @@ -43,13 +43,22 @@ class ESI extends Root { * @since 1.2.0 * @since 4.0 Change to be after Vary init in hook 'after_setup_theme' */ - public function init() { + 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 54a6ac8fc..d31e04f0b 100644 --- a/tpl/esi_widget_edit.php +++ b/tpl/esi_widget_edit.php @@ -78,8 +78,9 @@
- - + + +