If you experience an issue where users see content that they are not supposed to see, such as content meant for a different user group or category of users, here's what you need to know:
This kind of issue is usually indicative of a cache configuration problem. It is often caused by cache plugins such as WP Rocket, LiteSpeed Cache, W3 Total Cache, etc. or caching at the hosting level.
Cache plugins work by creating a snapshot of your site at a given point, and then showing users the snapshot, rather than the live site (this is much faster).
However, when you have different content for different users, these users cannot share the same cache (snapshot)!
To solve this problem, you must either enable a unique cache for each logged-in user, which is the best solution if available, or disable caching for logged-in users.
Popular cache plugin configurations:
(1) WP Rocket
When using WP Rocket, the best approach is to enable their user cache setting - this enables a unique cache for each logged in user, so it's a great and effective solution that maintains good performance.
(2) LiteSpeed Cache
With LiteSpeed, we're not aware of any way to enable a unique cache for each user, therefore we recommend disabling caching for logged in users, through the following setting:
(3) Other plugins
With most other cache plugins, there's usually a setting to disable caching for logged in users, which is our recommended approach.
Another alternative is to disable cache for specific user roles, but to use this you would need to first sync B2B groups with WP roles which adds more complexity to the setup.
Sometimes caching is added by hosting companies, and not necessarily visible, or done through a plugin.
One way to know if your hosting adds caching is to try making a site change such as changing the theme, and to see if your change is immediately reflected on the frontend. If you switch to a different theme but still see the old design initially, it's likely your hosting has a caching mechanism.
In such cases, it is best to check your hosting settings and/or contact them directly for advice.
Powered by BetterDocs