wp_get_user_request() WordPress Function

The wp_get_user_request function is used to get a user request object. A user request is an object used to request a user action from the WordPress user interface.

wp_get_user_request( int $request_id ) #

Returns the user request object for the specified request ID.


Parameters

$request_id

(int)(Required)The ID of the user request.


Top ↑

Return

(WP_User_Request|false)


Top ↑

Source

File: wp-includes/user.php

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
4.9.6Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More