Only Home page Admin Bar in WordPress disappear.
-
Hi! After the update (installed 16.03.2020 at HR +-22:00) I found the issue with my admin bar in WordPress, only in the main/home page, in other pages it appears normally. I’ve checked everything, appearance, login, cleaned cache and still the same problem. Hope you can solve.
Thank you.
Greetings, Artur.The page I need help with: [log in to see the link]
-
@sulainisart I have a suspicion that is related to the “dashicons” handle that could have been unloaded by mistake. Perhaps you unloaded a handle that is connected to “dashicons”. Can you please check the bottom of the page (while you are logged-in) for any non-styled content from the admin bar? Let me know if you notice anything there!
Hi Gabe!
You know what, the first thing I’ve noticed that at the beginning it was caching issue, I had to purge cache on plugin and CDN. Then, using plugin Asset CleanUp provoked that issue I think, or for the mistake, I deactivated some code… Still working on it, afterward anyway I hade another type of issue: Even if I wasn,t logged in to WordPress, in private session on my browser I was opening my website, and WordPress admin bar was pupping out anyway… Very strange.
Some ideas??
Thanks!@sulainisart If you’re positive the admin bar is only meant to load for the logged-in users (it should be as that’s the default behaviour in WordPress), then it’s a page caching issue. The most common one I’ve noticed was from Cloudflare. If you’re using Cloudflare and you don’t have a plan that allows to “Bypass Cache on Cookie”, you will likely get this issue as I know people who can’t afford (or not willing to pay that much) for a Business plan and will rather disable the admin bar (the problem is with other elements on the page if they show when an admin is logged-in, you don’t want your guest visitors to see something “Hello, admin!” on the page. You can read more about it here: https://blog.cloudflare.com/caching-anonymous-page-views/
Note that this doesn’t apply only for Cloudflare, but for any caching that is not taking into consideration specific cookies. Some hosting companies have internal page caching and you don’t need to use a caching plugin (e.g. WP Rocket) and in situations like this one they automatically prevent caching for pages that have logged-in related cookies set (especially configured for WordPress). In other cases, you might need to email them and explain them to change a setting for your website in their caching system to avoid caching if certain cookies are set.
Here’a a good explanation from Kinsta: https://kinsta.com/blog/wordpress-cookies-php-sessions/#3-exclude-pages-from-cache-when-the-cookie-is-present
I hope it makes sense. Let me know if you have any other questions at your earliest convenience!
Hello Gabe!
You’re absolutely right! In fact, I’m using Cloudflare and I felt like it is a caching issue, but if you already know that this is a common thing, that makes me feel better, at least I know in which direction I have to go… Thank you so much! I would like to ask you some more questions, some ideas that I had just now. 1. If I will log into admin WordPress only in private session it will not provoke this cockie-caching issue? 2. Onboard I’m using Autoptimize as a performance/caching tool at that point if I’m using CDN, the onboard caching is useless or provoke some conflict? 3.I’m as you sad, using the basic free plan of Cloudflare, should I write to them to modify the code (what should I tell them?)?
I hope i don’t bother you, and after this problem ill be totally good I hope…
If you can, give some answers to any of these questions, ill be very grateful!Stay Safe! Artur.
I found this on Cloudflare forum, maybe it may be helpful also for you in the future with your other costumers:
You probably have a Page Rule set to Cache Everything. So if it caches the page with an Admin logged in, it will cache the Admin bar as well. And maybe some other stuff you don’t want cached as well.
Disable that Page Rule. Or work around it in some/all of the following the ways:
Set your WordPress User to not show the Admin Bar when visiting the site.
Don’t surf your site while logged in (use an Incognito browser)
Put your site into Dev Mode when working on it.
Purge the cache whenever you’re done working on it.Now I’m understanding a little bit better the functionality…
@sulainisart thank you for pasting what you find on the Cloudflare forum here as it could help others understand this even better.
1. If I will log into admin WordPress only in private session it will not provoke this cockie-caching issue?
You can exclude (it’s likely happening already) /wp-admin/ from any page caching in Cloudflare even with the free plan so I wouldn’t worry about having the Dashboard cached and accessed by a guest. If everything is set correctly, it won’t happen. At least, it never did in so many years since I used Cloudflare on my websites and other clients’ websites.
2. Onboard I’m using Autoptimize as a performance/caching tool at that point if I’m using CDN, the onboard caching is useless or provoke some conflict?
Autoptimize is a front-end plugin and it works in combination with a page caching solution such as Cloudflare. Thus, it’s not a prloblem if you use both as long as you don’t mix the features. If you enable minify CSS/JS in Cloudflare (https://support.cloudflare.com/hc/en-us/articles/200168196-How-do-I-minify-HTML-CSS-and-JavaScript-to-optimize-my-site-), you might want to avoid doing the same thing in Autoptimize to avoid any conflicts (although you can often get away with it even if you double minify files).
3. I’m as you sad, using the basic free plan of Cloudflare, should I write to them to modify the code (what should I tell them?)?
From my past research (e.g. using their Dashboard and what I read in the forums, including what they mentioned in their documentation), you need to upgrade to a higher plan if you want to use certain features. Personally, I find it expensive to upgrade to the Business plan (and pay a monthly fee) just for this feature, although I think the service is good if you have the budget ($200/month) as I would recommend Cloudflare to my clients. If you’re on a tight budget, I would avoid the page caching feature on Cloudflare (you can do that within their Dashboard) and use a caching plugin for that such as WP Rocket.
- The topic ‘Only Home page Admin Bar in WordPress disappear.’ is closed to new replies.