Signed out of WordPress Admin section, yet the Admin bar remains on the frontend, prompting a quick fix? We understand why you’re worried and in a hurry. If you can see the bar, other user roles can, even if they are not permitted. Even worse,blem clearly implies that any visitor to your website can see the menu, and the idea of malicious people exploiting this opportunity is devastating. If the issue persists, they may study your code and even try to employ bots to wreak havoc in various ways. To prevent all that and breathe a sigh of relief, we’ll show you how to fix the WordPress Admin bar showing when logged out concern.
1. Clear cache from a WordPress caching plugin
First, let us set you at ease. Though the public might see the Admin bar and the link on it, in nearly all cases (never say never!) the links will not work. That is because WordPress has been in development for nearly two decades, and this is not its first rodeo, so to say. Thanks to clearly defined user roles, those with insufficient permissions cannot open pages even with access to direct links. With that said, the issue frequently stems from caching plugins for WordPress.
Why do caching plugins make the Admin bar keep showing when users are logged out?
Without getting into the nitty-gritty, normally when a visitor requests the web page through their browser, WordPress will begin querying a database and then loading the webpage after it runs PHP. In short, it “builds” a page using the requested data every time the visitor requests it. Caching plugins periodically check for versions of pages ready to be shown, save them, and serve them to visitors. This nearly eliminates page rendering speed, eradicates on-demand generation, and is beneficial for server resources.
They will update these versions from time to time to make sure visitors can see new pages or updates to old ones. With that in mind, the difficulty is caused by the incorrect setting. Your plugin or service cached the page for logged-in users (administrators, editors, writers, and anyone with a user role). It then shows the cached version of the logged-in version publicly. Even though they can’t use the Admin bar unless the site authenticates them, it’s something you should solve.
Changing settings and clearing caching plugin cache in WordPress
Now that you understand the culprit, you need to go to your plugin settings, configure the setting, and clear the cache so the changes apply. Since we can’t know which you decided to use, we’ll demonstrate how it works in a popular free one — W3 Total Cache, though we’re unaffiliated. Here’s what to do:
- Access the WordPress Admin section, i.e., log in.
- In the sidebar on the left-hand side, click on Performance.
- Select Page Cache.
- In the list of options, put a checkmark in front of Don’t cache pages for logged in users.
- Click on Save all settings.
- Go back to the page or pages and clear the cache. In most browsers, you can press Ctrl + F5 or Command + F5 if you don’t want to go through the browser interface. The Admin bar shouldn’t show up anymore.
2. Temporarily disable always-online, cache, and CDN WordPress plugins
Though the solution above should be a permanent fix for the WordPress Admin bar showing when logged out issue, sometimes that isn’t the case. If so, we presume you’re using a plugin that keeps your website online and perhaps presents pages through a Content Delivery Network (CDN). Cloudflare is a great example of this. But before you start digging through settings, we propose you disable these plugins for testing like this:
- Click the Plugins option in the left sidebar of WordPress Admin.
- Go to All Plugins.
- Checking the list of installed and active plugins that involve catching, always-online, or CDN. Click on Deactivate below their names one by one and clear the page or browser cache in-between. Once the WordPress Admin bar disappears, you found the root of the problem.
- Go through the plugin settings to find a configuration akin to the one in method 1. Alternatively, contact the developers or switch to a different plugin.
3. Update plugins and/or WordPress version
We know this might be a no-brainer at this point, but have you updated your WordPress plugins or WordPress itself recently? In many cases, if the two methods above don’t produce results and settings seem to be correct or don’t exist, outdated code can be the culprit. Therefore, double-check that there are no available updates before you proceed. We already taught you to upgrade WordPress to a newer version.
4. Hide the WordPress Admin bar showing when logged out to fix the problem
If nothing works, and you need time to figure things out (hiring a professional, contacting hosting Customer Support), you can deactivate the WordPress Admin bar temporarily. We explained the procedure to do so in our guide on editing a WordPress theme. With that said, you can add either of these two codes to functions.php, a site-specific plugin, or a code snippet plugin:
add_filter( ‘show_admin_bar’, ‘__return_false’ );
You can also use the following code:
Save changes and clear cache again before checking whether it works.