WP_REST_Application_Passwords_Controller::get_application_password( WP_REST_Request $request ): array|WP_Error

In this article

Gets the requested application password for a user.

Parameters

$requestWP_REST_Requestrequired
The request object.

Return

array|WP_Error The application password details if found, a WP_Error otherwise.

Source

protected function get_application_password( $request ) {
	$user = $this->get_user( $request );

	if ( is_wp_error( $user ) ) {
		return $user;
	}

	$password = WP_Application_Passwords::get_user_application_password( $user->ID, $request['uuid'] );

	if ( ! $password ) {
		return new WP_Error(
			'rest_application_password_not_found',
			__( 'Application password not found.' ),
			array( 'status' => 404 )
		);
	}

	return $password;
}

Changelog

VersionDescription
5.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.