publishpress / PublishPress-Capabilities

PublishPress Capabilities gives you control over all the permissions on your WordPress site.
13 stars 3 forks source link

Frontend feature not working when redis object cache is enabled #1152

Open olatechpro opened 1 month ago

olatechpro commented 1 month ago

From: https://secure.helpscout.net/conversation/2654571930/224318?viewId=2557461

olatechpro commented 1 month ago

From slack

The issue seems not to be from Capabilities but the cache plugin. They're not flushing wp cache when their flush cache is clicked.

Here's where Capabilities uses cache data https://github.com/publishpress/PublishPress-Capabilities/blob/development/includes/features/frontend-features/frontend-features-restrict.php#L47

We're using wp_cache_set and wp_cache_get to store and get cache data of frontend features which is WordPress default way.

In my test, I noticed the wp_cache_get keep returning cache data(which is empty) even after flushing cache.

I think they should reach out to the plugin support with this information (on their flush cache button not clearing wp_cache data) and then get back to us.

If they want a quick fix till they get response, they can replace $page_restriction_data = wp_cache_get($cache_key, 'data'); with $page_restriction_data = false;

So capabilities will always fetch new data