_wp_privacy_send_erasure_fulfillment_notification( int $request_id )
- Since
- 4.9.6
- Source
wp-includes/user.php:4394
Description
Without this, the user would never know if their data was actually erased.
Compatibility
- WordPress
- since 4.9.6
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$request_idint- The privacy request post ID associated with this request.
Performance profile
How much work a call to _wp_privacy_send_erasure_fulfillment_notification() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Expensive
- Scaling
- Constant
- Instructions
- 8–167
- Plugin surface
- 7 hooks
- Called by
- 0
Sends mail via wp_mail().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 175.
Third-party callbacks on 'user_erasure_fulfillment_email_to', 'user_erasure_complete_email_subject', 'user_erasure_fulfillment_email_subject' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters()called directly - optionoption read or write
get_option()called directly - mailsends mail
wp_mail()called directly - querycontent query
get_post()one call below _wp_privacy_send_erasure_fulfillment_notification() - cacheobject cache
wp_cache_get()one call below _wp_privacy_send_erasure_fulfillment_notification() - serializeserialisation
maybe_unserialize()one call below _wp_privacy_send_erasure_fulfillment_notification()
Further down the call graph this can also reach transient. That is the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 18 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost _wp_privacy_send_erasure_fulfillment_notification() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 8–11 | wp_get_user_request() |
$request instanceof | 18 | wp_get_user_request(), get_post_meta() |
$request instanceof && empty($request) && empty($email_data) | 155 | wp_get_user_request(), get_post_meta(), get_locale(), switch_to_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail() |
$request instanceof && !empty($request) && empty($email_data) | 156 | wp_get_user_request(), get_post_meta(), switch_to_user_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail() |
$request instanceof && empty($request) && empty($email_data) | 157 | wp_get_user_request(), get_post_meta(), get_locale(), switch_to_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), restore_previous_locale() |
$request instanceof && !empty($request) && empty($email_data) | 158 | wp_get_user_request(), get_post_meta(), switch_to_user_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), restore_previous_locale() |
$request instanceof && empty($request) && !empty($email_data) | 159 | wp_get_user_request(), get_post_meta(), get_locale(), switch_to_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail() |
$request instanceof && !empty($request) && !empty($email_data) | 160 | wp_get_user_request(), get_post_meta(), switch_to_user_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail() |
$request instanceof && empty($request) && empty($email_data) | 160 | wp_get_user_request(), get_post_meta(), get_locale(), switch_to_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), update_post_meta() |
$request instanceof && !empty($request) && empty($email_data) | 161 | wp_get_user_request(), get_post_meta(), switch_to_user_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), update_post_meta() |
$request instanceof && empty($request) && !empty($email_data) | 161 | wp_get_user_request(), get_post_meta(), get_locale(), switch_to_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), restore_previous_locale() |
$request instanceof && !empty($request) && !empty($email_data) | 162 | wp_get_user_request(), get_post_meta(), switch_to_user_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), restore_previous_locale() |
6 further outcomes, up to 167 instructions
$request instanceof && empty($request) && empty($email_data) | 162 | wp_get_user_request(), get_post_meta(), get_locale(), switch_to_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), restore_previous_locale(), update_post_meta() |
$request instanceof && !empty($request) && empty($email_data) | 163 | wp_get_user_request(), get_post_meta(), switch_to_user_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), restore_previous_locale(), update_post_meta() |
$request instanceof && empty($request) && !empty($email_data) | 164 | wp_get_user_request(), get_post_meta(), get_locale(), switch_to_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), update_post_meta() |
$request instanceof && !empty($request) && !empty($email_data) | 165 | wp_get_user_request(), get_post_meta(), switch_to_user_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), update_post_meta() |
$request instanceof && empty($request) && !empty($email_data) | 166 | wp_get_user_request(), get_post_meta(), get_locale(), switch_to_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), restore_previous_locale(), update_post_meta() |
$request instanceof && !empty($request) && !empty($email_data) | 167 | wp_get_user_request(), get_post_meta(), switch_to_user_locale(), apply_filters(), get_privacy_policy_url(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), __(), sprintf(), apply_filters(), sanitize_url(), apply_filters(), wp_mail(), restore_previous_locale(), update_post_meta() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 175 | 8–167 | 7 | |
| 8.5 | 175 | 8–167 | 7 | |
| 8.4 | 175 | 8–167 | 7 | 9 fewer instructions than PHP 8.3 |
| 8.3 | 184 | 8–176 | 7 | |
| 8.2 | 184 | 8–176 | 7 | |
| 8.1 | 184 | 8–176 | 7 | |
| 7.4 | 184 | 8–176 | 7 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 7
7 hooks fire while _wp_privacy_send_erasure_fulfillment_notification() runs, in this order:
- apply_filters( user_erasure_fulfillment_email_to )filterline 4422 (+28 into the body)
Filters the recipient of the data erasure fulfillment notification.
- do_action( user_erasure_complete_email_subject )filter_deprecatedline 4458 (+64 into the body)
Filters the subject of the email sent when an erasure request is completed.
- apply_filters( user_erasure_fulfillment_email_subject )filterline 4484 (+90 into the body)
Filters the subject of the email sent when an erasure request is completed.
- do_action( user_confirmed_action_email_content )filter_deprecatedline 4546 (+152 into the body)
Filters the body of the user request confirmation email.
- apply_filters( user_erasure_fulfillment_email_content )filterline 4585 (+191 into the body)
Filters the body of the data erasure fulfillment notification.
- do_action( user_erasure_complete_email_headers )filter_deprecatedline 4615 (+221 into the body)
Filters the headers of the data erasure fulfillment notification.
- apply_filters( user_erasure_fulfillment_email_headers )filterline 4643 (+249 into the body)
Filters the headers of the data erasure fulfillment notification.
Uses · 16
- wp_get_user_request()Returns the user request object for the specified request ID.
- get_post_meta()Retrieves a post meta field for the given post ID.
- switch_to_user_locale()Switches the translations according to the given user's locale.
- switch_to_locale()Switches the translations according to the given locale.
- get_locale()Retrieves the current locale.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- get_privacy_policy_url()Retrieves the URL to the privacy policy page.
- wp_specialchars_decode()Converts a number of HTML entities into their special characters.
- get_option()Retrieves an option value based on an option name.
- home_url()Retrieves the URL for the current site where the front end is accessible.
- __()Retrieves the translation of $text.
- apply_filters_deprecated()Fires functions attached to a deprecated filter hook.
Show all 16
- sanitize_url()Sanitizes a URL for database or redirect usage.
- wp_mail()Sends an email, similar to PHP's mail function.
- restore_previous_locale()Restores the translations according to the previous locale.
- update_post_meta()Updates a post meta field based on the given post ID.
Source code
function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! ( $request instanceof WP_User_Request ) || 'request-completed' !== $request->status ) { return; } $already_notified = (bool) get_post_meta( $request_id, '_wp_user_notified', true ); if ( $already_notified ) { return; } // 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 ); } else { $switched_locale = switch_to_locale( get_locale() ); } /** * Filters the recipient of the data erasure fulfillment notification. * * @since 4.9.6 * * @param string $user_email The email address of the notification recipient. * @param WP_User_Request $request The request that is initiating the notification. */ $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request ); $email_data = array( 'request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 'siteurl' => home_url(), ); $subject = sprintf( /* translators: Erasure request fulfilled notification email subject. %s: Site title. */ __( '[%s] Erasure Request Fulfilled' ), $email_data['sitename'] ); /** * Filters the subject of the email sent when an erasure request is completed. * * @since 4.9.8 * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_subject'} instead. * * @param string $subject The email subject. * @param string $sitename The name of the site. * @param array $email_data { * Data relating to the account action email. * * @type WP_User_Request $request User request object. * @type string $message_recipient The address that the email will be sent to. Defaults * to the value of `$request->email`, but can be changed * by the `user_erasure_fulfillment_email_to` filter. * @type string $privacy_policy_url Privacy policy URL. * @type string $sitename The site name sending the mail. * @type string $siteurl The site URL sending the mail. * } */ $subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.8.0', 'user_erasure_fulfillment_email_subject' ); /** * Filters the subject of the email sent when an erasure request is completed. * * @since 5.8.0 * * @param string $subject The email subject. * @param string $sitename The name of the site. * @param array $email_data { * Data relating to the account action email.Changelog
Introduced in 4.9.6. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/user.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.