ndiego / block-visibility

Conditional visibility controls for all WordPress blocks.
https://www.blockvisibilitywp.com
GNU General Public License v2.0
123 stars 10 forks source link

Add an extensibility mechanism for caching plugins #104

Open ndiego opened 3 months ago

ndiego commented 3 months ago

Block Visibility currently does not have a mechanism for clearing a page's cache when a block needs to become visible, such as with the Date & Time control. The general advice is to disable caching on pages that require dynamic content. Is there an extensibility mechanism that could be added to the plugin that would make it much easier for developers to use third-party caching plugins alongside Block Visibility?

Feedback from WP Rocket:

For the cache to be cleared automatically, the block would need to trigger an update of the post itself. So to make this work, maybe you could check with the plugin developer to see if there is any action that is fired when the block is supposed to become visible. Then you could write a small function that hooks into it to clear the cache for that post, using rocket_clean_post().