WP_Privacy_Requests_Table::process_bulk_action()
- Since
- 4.9.6, 5.6.0
- Source
wp-admin/includes/class-wp-privacy-requests-table.php:223
Compatibility
- WordPress
- since 5.6.0
- 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.
Performance profile
How much work a call to WP_Privacy_Requests_Table::process_bulk_action() 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
- Scales with input
- Instructions
- 11–68
- Plugin surface
- None
- Called by
- 0
Reaches the database via get_post().
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 159.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
do_action()one call below WP_Privacy_Requests_Table::process_bulk_action() - querycontent query
get_post()one call below WP_Privacy_Requests_Table::process_bulk_action()
Further down the call graph this can also reach option, mail, 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 · 8 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Privacy_Requests_Table::process_bulk_action() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($value) && empty($request_ids) | 11 | ->current_action() |
!isset($value) && !empty($request_ids) | 17–28 | ->current_action(), check_admin_referer() |
isset($value) && empty($request_ids) | 21 | ->current_action(), wp_unslash(), wp_parse_id_list() |
isset($value) && !empty($request_ids) | 27–38 | ->current_action(), wp_unslash(), wp_parse_id_list(), check_admin_referer() |
!isset($value) && !empty($request_ids) | 34–43 | ->current_action(), check_admin_referer(), _n(), sprintf(), add_settings_error() |
isset($value) && !empty($request_ids) | 44–53 | ->current_action(), wp_unslash(), wp_parse_id_list(), check_admin_referer(), _n(), sprintf(), add_settings_error() |
!isset($value) && !empty($request_ids) | 51–58 | ->current_action(), check_admin_referer(), _n(), sprintf(), add_settings_error(), _n(), sprintf(), add_settings_error() |
isset($value) && !empty($request_ids) | 61–68 | ->current_action(), wp_unslash(), wp_parse_id_list(), check_admin_referer(), _n(), sprintf(), add_settings_error(), _n(), sprintf(), add_settings_error() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 158 | 11–67 | 21 | 1 fewer instruction than PHP 8.5 |
| 8.5 | 159 | 11–68 | 21 | |
| 8.4 | 159 | 11–68 | 21 | |
| 8.3 | 159 | 11–68 | 21 | |
| 8.2 | 159 | 11–68 | 21 | |
| 8.1 | 159 | 11–68 | 21 | 1 more instruction than PHP 7.4 |
| 7.4 | 158 | 11–68 | 21 |
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.
Uses · 10
- wp_parse_id_list()Cleans up an array, comma- or space-separated list of IDs.
- wp_unslash()Removes slashes from a string or recursively removes slashes from strings within an array.
- check_admin_referer()Ensures intent by verifying that a user was referred from another admin page with the correct security nonce.
- _wp_privacy_resend_request()Resend an existing request and return the result.
- is_wp_error()Checks whether the given variable is a WordPress Error.
- add_settings_error()Registers a settings error to be displayed to the user.
- _n()Translates and retrieves the singular or plural form based on the supplied number.
- _wp_privacy_completed_request()Marks a request as completed by the admin and logs the current timestamp.
- wp_delete_post()Trashes or deletes a post or page.
- WP_Privacy_Requests_Table::current_action()
Source code
public function process_bulk_action() { $action = $this->current_action(); $request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array(); if ( empty( $request_ids ) ) { return; } $count = 0; $failures = 0; check_admin_referer( 'bulk-privacy_requests' ); switch ( $action ) { case 'resend': foreach ( $request_ids as $request_id ) { $resend = _wp_privacy_resend_request( $request_id ); if ( $resend && ! is_wp_error( $resend ) ) { ++$count; } else { ++$failures; } } if ( $failures ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( /* translators: %d: Number of requests. */ _n( '%d confirmation request failed to resend.', '%d confirmation requests failed to resend.', $failures ), $failures ), 'error' ); } if ( $count ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( /* translators: %d: Number of requests. */ _n( '%d confirmation request re-sent successfully.', '%d confirmation requests re-sent successfully.', $count ), $count ), 'success' ); } break; case 'complete': foreach ( $request_ids as $request_id ) { $result = _wp_privacy_completed_request( $request_id ); if ( $result && ! is_wp_error( $result ) ) { ++$count; } } add_settings_error( 'bulk_action', 'bulk_action', sprintf( /* translators: %d: Number of requests. */ _n( '%d request marked as complete.', '%d requests marked as complete.', $count ),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.
complete action.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-admin/includes/class-wp-privacy-requests-table.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.