From 14f4ed9c1221b93acf86642d4cf70bbe1dc7902f Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 5 Apr 2026 23:18:28 +0200 Subject: [PATCH 1/4] added two new functions --- src/wp-includes/functions.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 85b6043b0b5c8..2f9178a088432 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -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(), 'hourly', '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. * From e5a3a6975766e718a98896c2941e47a8d1b6ba38 Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 5 Apr 2026 23:19:27 +0200 Subject: [PATCH 2/4] enhanced filters privacy --- src/wp-includes/default-filters.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 4b6d9de25fa11..612a238b17794 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -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' ); From 6e2991819a4287689fd0f210c96699b4518079d0 Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 5 Apr 2026 23:20:10 +0200 Subject: [PATCH 3/4] fix timezone bug --- src/wp-admin/includes/privacy-tools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/privacy-tools.php b/src/wp-admin/includes/privacy-tools.php index 4f3379bff8909..45cf1c8719ff2 100644 --- a/src/wp-admin/includes/privacy-tools.php +++ b/src/wp-admin/includes/privacy-tools.php @@ -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', ), ), From 3e81cf330ed096776b5a1b6d118c48dca315ca45 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 6 Apr 2026 19:39:17 +0200 Subject: [PATCH 4/4] plan cron daily not hourly --- src/wp-includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 2f9178a088432..cf853e0f8fbcf 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -8482,7 +8482,7 @@ function wp_schedule_personal_data_cleanup_requests() { } if ( ! wp_next_scheduled( 'wp_privacy_personal_data_cleanup_requests' ) ) { - wp_schedule_event( time(), 'hourly', 'wp_privacy_personal_data_cleanup_requests' ); + wp_schedule_event( time(), 'daily', 'wp_privacy_personal_data_cleanup_requests' ); } }