WP Admin Bar Issue
-
Hi,
The plugin was breaking the admin bar on individual posts (not on pages). Tracked it down to post ID detection code (for Purge Current Page menu item).
Here’s the diff:
diff --git a/wp-content/plugins/w3-total-cache/Util_Environment.php b/wp-content/plugins/w3-total-cache/Util_Environment.php index 22bd41821..87ac0bcfb 100644 --- a/wp-content/plugins/w3-total-cache/Util_Environment.php +++ b/wp-content/plugins/w3-total-cache/Util_Environment.php @@ -1038,8 +1038,8 @@ class Util_Environment { return $post_ID; } elseif ( $comment_post_ID ) { return $comment_post_ID; - } elseif ( ( is_single() || is_page() ) && isset( $posts[0]->ID ) ) { - return $posts[0]->ID; + } elseif ( ( is_single() || is_page() ) && isset( $posts->posts[0]->ID ) ) { + return $posts->posts[0]->ID; } elseif ( isset( $posts->ID ) ) { return $posts->ID; } elseif ( isset( $_REQUEST['p'] ) ) {-
This topic was modified 6 years, 4 months ago by
alex.bradaric.
-
This topic was modified 6 years, 4 months ago by
-
Hello @alexbradaric
Thank you for the information.
Can you please share the screenshot of the mentioned issue?
I can’t seem to replicate this.
Thank you!Hi Marko,
Here are the screenshots without the fix ( https://staging.undercurrentnews.com/img/w3tc-without-fix.png ) and with the fix ( https://staging.undercurrentnews.com/img/w3tc-with-fix.png )
I’ve also reverted the fix I made here: https://staging.undercurrentnews.com/2017/11/17/scottish-salmon-prices-continue-rebound-norwegian-fall-back-to-two-year-low/
It breaks the page and does not finish loading it (including the admin bar).
Take care,
AlexHello @alexbradaric
Thank you for the information. We are checking this and we’ll reply as soon as we investigate.
Thank you!Hello @alexbradaric
Sorry for the late reply.
First, thank you for bringing this to our attention. I can confirm that this is a bug. We’ve fixed this and this will be included in the next release.
Thank you!Hi @vmarko
Thanks for getting back to me. That’s a step in the right direction – it doesn’t break the page any more.
However, there’s still the issue of the post ID for Purge Current Page menu item – your fix does not detect it correctly ( see the screenshot: https://staging.undercurrentnews.com/img/w3tc-0-post-id.png )
Thanks again 🙂
Take care,
Alex
The topic ‘WP Admin Bar Issue’ is closed to new replies.