Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin bar showing twice when ESI blocks are enabled with wp_body_open used in theme #687

Open
LeonLiutas opened this issue Jun 24, 2024 · 4 comments

Comments

@LeonLiutas
Copy link

Hello,

When I enable ESI mode, the admin bar is showing twice.

This happens because in the file wp-content/plugins/litespeed-cache/src/esi.cls.php on line 362, the wp_admin_bar_render function is removed from wp_footer.

However, since WordPress 5.4, the wp_admin_bar_render function is attached to the action wp_body_open. If this function is not utilized by the active theme, the admin bar will be still attached to wp_footer.

I would suggest to remove the action wp_admin_bar_render first from the wp_body_open action. If that fails, remove it from wp_footer for backwards compatibility.

@szepeviktor
Copy link
Contributor

lscache_wp/src/esi.cls.php

Lines 360 to 364 in 2564cb0

// Add admin_bar esi
if (Router::is_logged_in()) {
remove_action('wp_footer', 'wp_admin_bar_render', 1000);
add_action('wp_footer', array($this, 'sub_admin_bar_block'), 1000);
}

@timotei-litespeed
Copy link
Contributor

@LeonLiutas thank you for sending the issue. We are aware of the issue and a fix will come :)

@timotei-litespeed
Copy link
Contributor

@LeonLiutas can test a solution here: #635

@Tymotey
Copy link
Contributor

Tymotey commented Jul 29, 2024

@LeonLiutas fix will come in version 6.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants