wp_get_user_request( int $request_id ): WP_User_Request|false
- Since
- 4.9.6
- Source
wp-includes/user.php:4983
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 ID of the user request.
Return value
WP_User_Request|false
Performance profile
How much work a call to wp_get_user_request() 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
- 11–17
- Plugin surface
- None
- Called by
- 15
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 18.
Nothing here hands control to plugin code.
15 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- querycontent query
get_post()called directly
Further down the call graph this can also reach hook, 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 · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_get_user_request() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 11–17 | absint(), get_post() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 18 instructions, 11–17 executed per call, 2 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.
Uses · 3
- absint()Converts a value to non-negative integer.
- get_post()Retrieves post data given a post ID or post object.
- WP_User_Request::__construct()Constructor.
Used by · 15
- WP_Privacy_Requests_Table::prepare_items()Prepares items to output.
- _wp_privacy_account_request_confirmed()Updates log when privacy request is confirmed.
- _wp_privacy_account_request_confirmed_message()Returns request confirmation message HTML.
- _wp_privacy_completed_request()Marks a request as completed by the admin and logs the current timestamp.
- _wp_privacy_send_erasure_fulfillment_notification()Notifies the user when their erasure request is fulfilled.
- _wp_privacy_send_request_confirmation_notification()Notifies the site administrator via email when a request is confirmed.
- wp_ajax_wp_privacy_erase_personal_data()Handles erasing personal data via AJAX.
- wp_ajax_wp_privacy_export_personal_data()Handles exporting a user's personal data via AJAX.
- wp_get_user_request_data()Return the user request object for the specified request ID.
- wp_privacy_generate_personal_data_export_file()Generate the personal data export file.
- wp_privacy_process_personal_data_erasure_page()Mark erasure requests as completed after processing is finished.
- wp_privacy_process_personal_data_export_page()Intercept personal data exporter page Ajax responses in order to assemble the personal data export file.
Show all 15
- wp_privacy_send_personal_data_export_email()Send an email to the user with a link to the personal data export file
- wp_send_user_request()Send a confirmation request email to confirm an action.
- wp_validate_user_request_key()Validates a user request by comparing the key with the request's key.
Source code
function wp_get_user_request( $request_id ) { $request_id = absint( $request_id ); $post = get_post( $request_id ); if ( ! $post || 'user_request' !== $post->post_type ) { return false; } return new WP_User_Request( $post );}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.7.7 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.