Solution: The WordPress Admin Bar Shows When Logged Out!

DEVELOPMENT

Solution: The WordPress Admin Bar Shows When Logged Out!

If you find that your WordPress admin bar is visible to the public, don't worry. You will find the solution here, and is related to a simple plugin setting

We had helped quite a few people with this issue, including about a year ago ourselves when we had a 15-minute panic because the WordPress admin. bar refused to disappear even though we were not logged in.

Fearing that the whole world has access to the inner workings of your WordPress website can make it quite a stressful situation, especially when the answer is not easy to be found. It is for this very reason, after helping some people with this very problem on Reddit, that we have decided to document the solution so that others can easily find it.

WordPress admin bar shows for logged out users (imported #26312)

The Cause — W3 Total Cache

W3 Total Cache is a plug in that will cache the HTML of the page so that on subsequent page views it can be served directly from the cache rather than having to query the database or render PHP scripts. This significantly speeds up the render time of your webpage as well as reducing the load on the web server. We have a very detailed tutorial on how to set up and configure W3 Total Cache along with CloudFlare, including some downloadable settings for you to import. Following that tutorial will also fix your issue.

The problem is caused by you caching the HTML that is shown for logged in users. What this means is that the cached page is then reproducing what the logged in user sees for subsequent visitors, which includes the admin. bar. Therefore the admin. bar will show when viewing your website even when logged out.

The Solution — Change the W3 Total Cache Settings

The solution is very easy. Just navigate to Page Cache Settings under the W3 Total Cache Performance Menu, and tick the box that says "

dont cache page for logged in users

Also, to put your mind at ease, at no time would the public been able to access any of the admin. functionality even though they could see the admin. toolbar. All they saw was the HTML, but unless they were also logged in with the requisite user permissions, they could do nothing.

Check out our top user-rated host: SiteGround
Need help choosing a hosting provider?
Check out our top user-rated host: SiteGround