WP_REST_Application_Passwords_Controller::get_application_password() protected WP 5.6.0
Gets the requested application password.
{} It's a method of the class: WP_REST_Application_Passwords_Controller{}
No Hooks.
Return
Array/WP_Error. The application password details if found, a WP_Error otherwise.
Usage
// protected - for code of main (parent) or child class $result = $this->get_application_password( $request );
- $request(WP_REST_Request) (required)
- The request object.
Changelog
Since 5.6.0 | Introduced. |
Code of WP_REST_Application_Passwords_Controller::get_application_password() WP REST Application Passwords Controller::get application password WP 5.6
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;
}