Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-admin/includes/privacy-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function _wp_personal_data_cleanup_requests() {
'fields' => 'ids',
'date_query' => array(
array(
'column' => 'post_modified_gmt',
'column' => 'post_modified',
'before' => $expires . ' seconds ago',
),
),
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@
add_filter( 'wp_privacy_personal_data_erasers', 'wp_register_comment_personal_data_eraser' );
add_action( 'init', 'wp_schedule_delete_old_privacy_export_files' );
add_action( 'wp_privacy_delete_old_export_files', 'wp_privacy_delete_old_export_files' );
add_action( 'init', 'wp_schedule_personal_data_cleanup_requests' );
add_action( 'wp_privacy_personal_data_cleanup_requests', 'wp_cron_personal_data_cleanup_requests' );

// Cron tasks.
add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
Expand Down
30 changes: 30 additions & 0 deletions src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8471,6 +8471,36 @@ function wp_schedule_delete_old_privacy_export_files() {
}
}

/**
* Schedules a WP-Cron job to clean up personal data requests.
*
* @since 7.1.0
*/
function wp_schedule_personal_data_cleanup_requests() {
if ( wp_installing() ) {
return;
}

if ( ! wp_next_scheduled( 'wp_privacy_personal_data_cleanup_requests' ) ) {
wp_schedule_event( time(), 'daily', 'wp_privacy_personal_data_cleanup_requests' );
}
}

/**
* Fires the personal data cleanup requests handler during cron.
*
* Loads the admin privacy tools file if needed (e.g. during cron, where
* wp-admin/includes/privacy-tools.php is not loaded automatically).
*
* @since 7.1.0
*/
function wp_cron_personal_data_cleanup_requests() {
if ( ! function_exists( '_wp_personal_data_cleanup_requests' ) ) {
require_once ABSPATH . 'wp-admin/includes/privacy-tools.php';
}
_wp_personal_data_cleanup_requests();
}

/**
* Cleans up export files older than three days old.
*
Expand Down
Loading