Filter: bricks/drafts/keep_days
Since Bricks 2.5, bricks/drafts/keep_days changes when Bricks removes finished draft records and publish undo points during automatic cleanup.
Parameter and return value
Section titled “Parameter and return value”$days(int): The cleanup age in days, measured from each record’s last update. Default:30.- Return the desired number of days. Bricks casts it to an integer and uses a minimum of
1. Returning0orfalsedoes not mean unlimited retention or immediate deletion.
Example usage
Section titled “Example usage”Keep eligible records for 60 days after their last update:
add_filter( 'bricks/drafts/keep_days', function( $days ) { return 60;} );Add the filter in a plugin or child theme that loads during WP-Cron requests.
What cleanup removes
Section titled “What cleanup removes”Once a record’s last update is older than the configured period, cleanup can remove:
- Finished records marked published or discarded.
- Publish undo points, including undo points that are still available under Versions > Undo a publish.
Cleanup also removes the stored items and review-link records belonging to those removed records. This is separate from a review link’s own expiry.
Active editable page drafts and site versions are not removed by age. A named site version stays active after publishing, so it remains available for later work; its publish undo points still have the cleanup window above.
Cleanup runs on a scheduled daily WP-Cron task while Drafts is enabled. Changing the filter does not delete records immediately. Undo points older than the configured window can be removed on the next cleanup; increasing the period cannot recover an undo point already removed.
For the independent retention rules governing individual shared-item history, see bricks/global_history/keep_days.
Was this helpful?
A quick vote and short notes help us improve these docs faster.
Leave a note for us
Please do not include passwords, license keys, or personal data. We store submitted notes to improve the docs.
Thanks for sharing feedback. We're using it to improve these docs.