diff --git a/src/esi.cls.php b/src/esi.cls.php index 25e724acb..69c1596c6 100644 --- a/src/esi.cls.php +++ b/src/esi.cls.php @@ -359,6 +359,9 @@ private function _register_not_esi_actions() // Add admin_bar esi if (Router::is_logged_in()) { + // Remove default Admin bar. Fix https://github.com/elementor/elementor/issues/25198 + remove_action('wp_body_open', 'wp_admin_bar_render', 0); + add_action('wp_body_open', array($this, 'sub_admin_bar_block'), 0); remove_action('wp_footer', 'wp_admin_bar_render', 1000); add_action('wp_footer', array($this, 'sub_admin_bar_block'), 1000); } @@ -760,7 +763,12 @@ public function sub_widget_block($instance, $widget, $args) public function sub_admin_bar_block() { global $wp_admin_bar; + static $rendered = false; + if ( $rendered ) { + return; + } + if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) { return; } @@ -771,6 +779,8 @@ public function sub_admin_bar_block() ); echo $this->sub_esi_block('admin-bar', 'adminbar', $params); + + $rendered = true; } /**