Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cached admin bar showing to visitors: how to find and fix it

OPS-109Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

Most content management systems add extra HTML when you are logged in. In WordPress this is the black admin bar at the top, plus "Edit page" links. Shopify themes, Webflow and others have similar preview or editor bars. This extra HTML should only ever reach you.

A cache is a layer that stores a finished copy of a page and serves it to many people. If the cache stores the copy built for you, it hands that copy to everyone. The cache can be a plugin, your host's server cache, or a CDN (content delivery network) such as Cloudflare.

Why it costs you leads or sales

The impact is medium, but it is easy to miss because you rarely see your own site logged out. Visitors see a site that looks broken or unprofessional, which lowers trust at the exact moment they decide to enquire or buy.

What visitors may experience
  • A black admin bar or toolbar across the top of the page, which can push the header down or overlap a sticky menu
  • Edit, Customize or Dashboard links that lead to a login screen
  • Layout shifts or a hidden header, so a call-to-action button sits out of place
  • Private details in the page source, such as your username, nonces or draft notices
  • Extra scripts loaded only for admins, which can slow the page or throw errors
How the admin view reaches visitors
  1. You load the page logged inThe page includes the admin bar
  2. Cache stores that copyLogged-in cookie is ignored
  3. Visitor requests the pageGets the cached admin copy
  4. Visitor sees a broken-looking pageTrust drops, CTA may be displaced

One logged-in request poisons the cache for everyone after it.

How to check if your site has it

Check the page as a visitor
  1. Open a private window

    Use an incognito or private window where you are not logged in, then load the affected page.

  2. Look for admin elements

    Check the top of the page for a toolbar and for Edit links. Right-click and choose View source, then search for admin-bar or wpadminbar.

  3. Test from another device

    Load the page on your phone using mobile data. This avoids your own browser and office network.

  4. Read the cache headers

    In browser developer tools, open the Network tab, click the page request and look at the response headers. Values such as cf-cache-status: HIT, x-cache: HIT or age show a cached copy was served.

  5. Check several URLs

    Test the home page, a key landing page and a form page. Only some URLs may be affected.

Check from the command line (no cookies sent)bash
curl -s https://www.example.com/ | grep -i -E 'wpadminbar|admin-bar'
curl -sI https://www.example.com/ | grep -i -E 'cache|age|set-cookie'

If the first command prints any lines, the public copy contains the admin bar. Replace the example address with your own.

How to fix it

The cause is almost always a cache rule that ignores the logged-in cookie, or a cache that was warmed while you were logged in. Fix the rule, then purge. Purging first without fixing the rule lets it happen again.

Fix by platform
  1. Exclude logged-in users in your cache plugin

    Most plugins (WP Rocket, W3 Total Cache, LiteSpeed Cache, WP Super Cache) skip caching for logged-in users by default. Open the plugin's cache settings and make sure the option for logged-in users is not set to cache them. The exact menu name differs by plugin.

  2. Check the host cache

    Managed hosts often run a server cache too. Look in your host's dashboard or the host's plugin for a cache exclusion list and confirm the wordpress_logged_in cookie is excluded.

  3. Purge all caches

    Clear the plugin cache, the host cache and the CDN cache, in that order.

nginx: skip the cache for logged-in WordPress usersnginx
set $skip_cache 0;
if ($http_cookie ~* "wordpress_logged_in|comment_author|wp-postpass") {
    set $skip_cache 1;
}
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
Fix it at the CDN (for example Cloudflare)
  1. Find any Cache Everything rule

    In Cloudflare, open Caching, then Cache Rules (or Page Rules on older setups). A rule that caches HTML for all requests is the usual cause.

  2. Add a bypass for the login cookie

    Create a rule placed before the cache rule: if the Cookie header contains wordpress_logged_in or wp-, set the cache to Bypass. Also bypass /wp-admin and /wp-login.php.

  3. Purge the CDN cache

    Use Purge Cache, then Purge Everything, or purge the affected URLs.

  4. Log out when warming caches

    If you run a cache preload or warm-up, make sure it runs without your login cookie.

How to confirm it's fixed

Confirmation checks
  • Load the page in a private window and confirm no toolbar or edit links appear
  • Run the curl grep command and confirm it prints nothing
  • Reload twice so you are sure you are seeing a cached copy (header shows HIT), and confirm it is still clean
  • Log in, load the page and confirm you still see the admin bar (you should)
  • Test the home page, key landing pages and form pages
Visitor view

Before

  • Admin bar visible to everyone
  • Edit links lead to a login screen
  • Header may be pushed down

After

  • Clean page for visitors
  • Admin bar only for logged-in users
  • Cache bypassed on the login cookie

How to prevent it happening again

Prevention habits
  • After any cache or CDN rule change, test the page in a private window
  • Never use a Cache Everything rule on HTML without a cookie bypass above it
  • Keep preload and warm-up jobs logged out
  • Check the page logged out after theme, plugin and host changes
  • Write down every caching layer your site uses and who controls it

How FunnelGuard handles this

FunnelGuard does not check for this yet. It is a possible future check. Today FunnelGuard does not look for an admin bar or logged-in elements in the public page.

What it does cover nearby: a robot visitor runs your real journeys, such as lead forms and checkouts, on a schedule. It checks each step, so if a displaced header or a broken layout stops a button or form from working, the journey fails, is re-checked from a second region, and you get an alert with a screenshot. That only catches cases where the admin view breaks a step, not a cosmetic bar.

To watch for it yourself, add a recurring reminder to open your top pages in a private window after each release, or use any uptime or content monitor that can alert when the text wpadminbar appears in a page's HTML.

Questions people ask

Why is the WordPress admin bar showing to visitors?

A cache stored the page while you were logged in and now serves that copy to everyone. This usually happens when a plugin, host cache or CDN rule ignores the logged-in cookie. Exclude logged-in users from caching and purge all caches.

How do I remove the admin bar from the cached page?

Fix the cache rule first, then purge the plugin cache, host cache and CDN cache. Reload the page in a private window to confirm the bar is gone. Purging without fixing the rule lets the problem return.

Does Cloudflare cache the WordPress admin bar?

It can, if you use a Cache Everything rule for HTML without a bypass for the login cookie. Add a Cache Rule that bypasses the cache when the Cookie header contains wordpress_logged_in, and bypass /wp-admin. Then purge the cache.

Is a cached admin bar a security risk?

It can be. Beyond the visible bar, the page source may expose your username, nonces or draft content. Treat it as a leak, fix the cache and purge everything promptly.

Why do I only see the admin bar when logged out on some pages?

Only pages cached while you were logged in carry it. Other pages were cached by a visitor or never cached. Test your key URLs and purge the affected ones.

How can I tell if a page is served from cache?

Open developer tools, go to the Network tab and check the response headers on the page request. Values like cf-cache-status: HIT, x-cache: HIT or an age header mean a cached copy was served.

Does FunnelGuard detect a cached admin bar?

No, FunnelGuard does not check for this yet. It does run your real journeys and alert you if a step such as a form or button fails. Use a private-window check or a content monitor for the admin bar itself.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.