Title: WP Admin Bar Issue
Last modified: February 4, 2020

---

# WP Admin Bar Issue

 *  Resolved [alex.bradaric](https://wordpress.org/support/users/alexbradaric/)
 * (@alexbradaric)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/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](https://wordpress.org/support/users/alexbradaric/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/wp-admin-bar-issue/#post-12396989)
 * Hello [@alexbradaric](https://wordpress.org/support/users/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!
 *  Thread Starter [alex.bradaric](https://wordpress.org/support/users/alexbradaric/)
 * (@alexbradaric)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/wp-admin-bar-issue/#post-12397082)
 * Hi Marko,
 * Here are the screenshots without the fix ( [https://staging.undercurrentnews.com/img/w3tc-without-fix.png](https://staging.undercurrentnews.com/img/w3tc-without-fix.png))
   and with the fix ( [https://staging.undercurrentnews.com/img/w3tc-with-fix.png](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/](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,
    Alex
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/wp-admin-bar-issue/#post-12397698)
 * Hello [@alexbradaric](https://wordpress.org/support/users/alexbradaric/)
 * Thank you for the information. We are checking this and we’ll reply as soon as
   we investigate.
    Thank you!
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/wp-admin-bar-issue/#post-12459002)
 * Hello [@alexbradaric](https://wordpress.org/support/users/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](https://github.com/W3EDGE/w3-total-cache/commit/296499f63f20d21f1b5c8ebb787c60ce089277a3)
   this and this will be included in the next release. Thank you!
 *  Thread Starter [alex.bradaric](https://wordpress.org/support/users/alexbradaric/)
 * (@alexbradaric)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/wp-admin-bar-issue/#post-12459085)
 * Hi [@vmarko](https://wordpress.org/support/users/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](https://staging.undercurrentnews.com/img/w3tc-0-post-id.png))
 * Thanks again 🙂
 * Take care,
    Alex

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WP Admin Bar Issue’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [wp-admin-bar](https://wordpress.org/support/topic-tag/wp-admin-bar/)

 * 5 replies
 * 2 participants
 * Last reply from: [alex.bradaric](https://wordpress.org/support/users/alexbradaric/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/wp-admin-bar-issue/#post-12459085)
 * Status: resolved