Add a filter to disable Homepage cache clearing in function rocket_clean_post #7276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #7187
Adds a filter which gives developers the opportunity to disable the purging of the homepage cache whenever the function rocket_clean_post is triggered.
Type of change
Detailed scenario
I some cases the automatic purging of the homepage cache whenever the function rocket_clean_post is called is not desirable. For example if you run a WooCommerce webshop with stock management. Whenever an order is placed the function rocket_clean_post will get called. If you have a busy webshop, for example every 5 minutes an order, the homepage cache would be cleared every 5 minutes. Pre-loading the cache won't help if the webshop has a lot of products, it would take too long before the homepage would get pre-loaded.
Technical description
Documentation
The filter itself does nothing, developers can hook into it and return false to prevent the homepage cache from being cleared.
New dependencies
None.
Risks
None.
Mandatory Checklist
Code validation
Code style
Unticked items justification
I'm uncertain in which style WP Rocket likes to have the comments. The change is simple enough to add.
Additional Checks