wp_privacy_process_personal_data_erasure_page( array $response, int $eraser_index, string $email_address, int $page, int $request_id ): array
- Since
- 4.9.6
- Source
wp-admin/includes/privacy-tools.php:915
Description
This intercepts the Ajax responses to personal data eraser page requests, and monitors the status of a request. Once all of the processing has finished, the request is marked as completed.
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
$responsearray- The response from the personal data eraser for the given page.
$eraser_indexint- The index of the personal data eraser. Begins at 1.
$email_addressstring- The email address of the user whose personal data this is.
$pageint- The page of personal data for this eraser.
Begins at 1. $request_idint- The request ID for this personal data erasure.
Return value
array- The filtered response.
Performance profile
How much work a call to wp_privacy_process_personal_data_erasure_page() 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
- Heavy
- Scaling
- Constant
- Instructions
- 8–47
- Plugin surface
- 2 hooks
- Called by
- 0
Reaches the database via get_post().
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 53.
Third-party callbacks on 'wp_privacy_personal_data_erasers', 'wp_privacy_personal_data_erased' 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 - querycontent query
get_post()one call below wp_privacy_process_personal_data_erasure_page()
Further down the call graph this can also reach option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 5 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_privacy_process_personal_data_erasure_page() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 8–16 | none |
is_array($response) && $response | 33–34 | wp_get_user_request(), apply_filters() |
is_array($response) && $response | 36–40 | wp_get_user_request(), __(), wp_send_json_error(), apply_filters() |
is_array($response) && $response && $eraser_index === false | 41 | wp_get_user_request(), apply_filters(), _wp_privacy_completed_request(), do_action() |
is_array($response) && $response && $eraser_index === false | 44–47 | wp_get_user_request(), __(), wp_send_json_error(), apply_filters(), _wp_privacy_completed_request(), do_action() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 53 instructions, 8–47 executed per call, 9 branches. The work does not change between versions.
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 · 2
2 hooks fire while wp_privacy_process_personal_data_erasure_page() runs, in this order:
- apply_filters( wp_privacy_personal_data_erasers )filterline 949 (+34 into the body)
Filters the array of personal data eraser callbacks.
- do_action( wp_privacy_personal_data_erased )actionline 966 (+51 into the body)
Fires immediately after a personal data erasure request has been marked completed.
Uses · 6
- wp_get_user_request()Returns the user request object for the specified request ID.
- wp_send_json_error()Sends a JSON response back to an Ajax request, indicating failure.
- __()Retrieves the translation of $text.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- _wp_privacy_completed_request()Marks a request as completed by the admin and logs the current timestamp.
- do_action()Calls the callback functions that have been added to an action hook.
Source code
function wp_privacy_process_personal_data_erasure_page( $response, $eraser_index, $email_address, $page, $request_id ) { /* * If the eraser response is malformed, don't attempt to consume it; let it * pass through, so that the default Ajax processing will generate a warning * to the user. */ if ( ! is_array( $response ) ) { return $response; } if ( ! array_key_exists( 'done', $response ) ) { return $response; } if ( ! array_key_exists( 'items_removed', $response ) ) { return $response; } if ( ! array_key_exists( 'items_retained', $response ) ) { return $response; } if ( ! array_key_exists( 'messages', $response ) ) { return $response; } // Get the request. $request = wp_get_user_request( $request_id ); if ( ! $request || 'remove_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when processing personal data to erase.' ) ); } /** This filter is documented in wp-admin/includes/ajax-actions.php */ $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); $is_last_eraser = count( $erasers ) === $eraser_index; $eraser_done = $response['done']; if ( ! $is_last_eraser || ! $eraser_done ) { return $response; } _wp_privacy_completed_request( $request_id ); /** * Fires immediately after a personal data erasure request has been marked completed. * * @since 4.9.6 * * @param int $request_id The privacy request post ID associated with this request. */ do_action( 'wp_privacy_personal_data_erased', $request_id ); return $response;}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 7.0.4 tag, from
src/wp-admin/includes/privacy-tools.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.