Commit 11fb838782 for wordpress.org
commit 11fb838782703398577b44f88b70516d5a93b1a5
Author: audrasjb <audrasjb@1a063a9b-81f0-0310-95a4-ce76da25c4cd>
Date: Tue Nov 17 08:02:02 2026 +0000
Privacy: Add a check for post status in `wp_privacy_send_personal_data_export_email()`.
In `wp_privacy_send_personal_data_export_email()`, the post status was not previously validated before sending the export email. This could lead to export emails being sent for unconfirmed or invalid requests (e.g. `request-pending`, `request-failed`).
Developed in https://github.com/WordPress/wordpress-develop/pull/12759.
Props pbearne, wildworks, mindctrl, masteradhoc, therssoftware, im3dabasia1.
Fixes #65758.
Built from https://develop.svn.wordpress.org/trunk@65545
git-svn-id: http://core.svn.wordpress.org/trunk@64618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/privacy-tools.php b/wp-admin/includes/privacy-tools.php
index 17e660c8c0..f0a53f2651 100644
--- a/wp-admin/includes/privacy-tools.php
+++ b/wp-admin/includes/privacy-tools.php
@@ -587,6 +587,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
* Send an email to the user with a link to the personal data export file
*
* @since 4.9.6
+ * @since 7.2.0 Returns a `WP_Error` if the request is not confirmed or completed.
*
* @param int $request_id The request ID for this personal data export.
* @return true|WP_Error True on success or `WP_Error` on failure.
@@ -599,6 +600,10 @@ function wp_privacy_send_personal_data_export_email( $request_id ) {
return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) );
}
+ if ( ! in_array( $request->status, array( 'request-confirmed', 'request-completed' ), true ) ) {
+ return new WP_Error( 'invalid_request', __( 'Invalid request status when sending personal data export email.' ) );
+ }
+
// Localize message content for user; fallback to site default for visitors.
if ( ! empty( $request->user_id ) ) {
$switched_locale = switch_to_user_locale( $request->user_id );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index bc732bed7a..51eb138196 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta5-65544';
+$wp_version = '7.2-beta5-65545';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.