Filter: bricks/global_history/keep_days
Since Bricks 2.5, bricks/global_history/keep_days changes the age window used when cleaning up Global Data Revisions.
Parameter and return value
Section titled “Parameter and return value”$days(int): The number of days of recent history to keep. Default:90.- Return the desired number of days. Bricks casts it to an integer and uses a minimum of
1. Returning0orfalsedoes not delete all history or disable cleanup.
Example usage
Section titled “Example usage”Protect all history recorded within the last 30 days:
add_filter( 'bricks/global_history/keep_days', function( $days ) { return 30;} );Add the filter in a plugin or child theme that loads during WP-Cron requests.
How it combines with the entry count
Section titled “How it combines with the entry count”The age window is not a maximum age for every stored entry. Bricks also protects each item’s latest entries through bricks/global_history/keep_latest, which defaults to 20.
Cleanup removes an entry only when it is older than the configured age window and outside that latest-entry count. With the example above and the default count, an item retains all entries from the last 30 days plus its latest 20 entries, even when some of those 20 are older.
The filter is read during scheduled daily cleanup. Changing it does not remove entries immediately. Cleanup depends on WP-Cron running, and increasing the period cannot recover entries already pruned.
This filter does not control page revisions or draft undo points. For finished drafts and version undo points, see bricks/drafts/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.