-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with WP Rocket logged-in user cache #126
Comments
Hi Jory, Following up on the discussion on wp.org, may I ask how does View Admin As keeps track of the current role it is emulating? So that I can see if there is any exclusion option in WP-Rocket that could work. |
Hi @lucspe I store the view in the user metadata and at a very early stage in the The view class handles all switching: |
Hi @lucspe I was just wondering is you might have found a solution. Let me know! |
So this is definetely an issue that manifests if WP-Rocket is enabled and cache is enabled for logged in users. As a temporary workaround, I simply add a bogus variable to the URL (i,e, "?whatever") before doing the switch. This way, when the page reloads with the new role it will bypass the cache. I was looking into WP-Rocket documentation and it seems that is possible to to exclude admins from cache even when it is enabled for logged in users: https://docs.wp-rocket.me/article/919-disable-cache-for-logged-in-administrators However I am not sure if this approach could be useful for compatibility with VAA. |
Hi @lucspe Thank you for this resource. I've created a patch that I think might help in your case: Could you try this? |
Thanks. It doesn't work unfortunately. |
Did you clear your cache before testing? |
Hi @JoryHogeveen, I tried once again to be sure. I have cleared the cache several times and it doesn't work unfortunately. Specifically, clearing the cache makes it work once (just like adding a non existing variable to the URL). |
I'm getting the same problem but with Litespeed cache, did you solve this for WP Rocket? Adding a query parameter while VAA is active may work as I can then exclude the view from being cached. I can also exclude via cookies. |
hi @joncon62 , nope. Currently in the only site where I need cache active also for logged in users I bypass the cache adding a query variable to the URL. |
Unfortunately, it seems cache plugins run their code even before plugins are loaded. This of course greatly enhances speed but results in a plugin like this not being able to function. I could of course always add a refresh param when switching but that still won't work with browsing though the site. Ideas on how to properly address this are very welcome! |
Also having issues when using Litespeed. I don't have private cache enabled and caching is turned off for all roles. I did discover that it's only "broken" when I view as site visitor. If I view as subscriber, I can change the view back or reset to default properly. I'm happy to make my site available to Jory for testing if that would be helpful. Thank again Jory for a great plugin. |
When viewing as a visitor the page cache would be enabled. |
More info: https://wordpress.org/support/topic/compatibility-with-wp-rocket-11/
Basically, when cache is enabled for logged in users it prevents View Admin As from working correctly.
I'll have to check if there are some filters available to bypass cache or find some other solution.
The text was updated successfully, but these errors were encountered: