benecaster_gdpr_retention_skip
Allows aborting the entire nightly GDPR retention cron sweep before it begins.
When It Fires
Fires once at the start of the nightly retention cron job, before any users are evaluated or erased. Return true to abort the entire sweep — no users will be processed during this run. Does not affect manual single-user deletions triggered via the REST endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
$skip |
bool | Whether to abort the sweep. Default false. |
$retention_days |
int | The configured data retention window in days. |
Notes
- Returning
trueskips the entire cron sweep silently. No users are erased during that run. - This filter only applies to the nightly cron job. Manual deletions via the REST endpoint are controlled per-user by
benecaster_gdpr_purge_skip. - The next scheduled cron run will fire this filter again — a
truereturn only suppresses the current run. - Use this hook for maintenance windows, migration periods, or integration scenarios where automated erasure must be temporarily paused.
Example Usage
add_filter( 'benecaster_gdpr_retention_skip', function ( bool $skip, int $retention_days ): bool {
// Abort the sweep if a site-wide maintenance flag is active
if ( get_option( 'my_plugin_maintenance_mode' ) ) {
return true;
}
return $skip;
}, 10, 2 );
Related Hooks
benecaster_gdpr_purge_skip— skips erasure for a specific user (applies to both cron and manual)- [
benecaster_before_gdpr_purge](/docs/benecaster_before_gdpr_purge/) — fires just before a per-user erasure cascade executes