W3cubDocs

/WordPress

WP_Application_Passwords::get_user_application_password( int $user_id, string $uuid ): array|null

Gets a user’s application password with the given UUID.

Parameters

$user_idintrequired
User ID.
$uuidstringrequired
The password’s UUID.

Return

array|null The application password if found, null otherwise.
  • uuid string
    The unique identifier for the application password.
  • app_id string
    A UUID provided by the application to uniquely identify it.
  • name string
    The name of the application password.
  • password string
    A one-way hash of the password.
  • created int
    Unix timestamp of when the password was created.
  • last_used int|null
    The Unix timestamp of the GMT date the application password was last used.
  • last_ip string|null
    The IP address the application password was last used by.

Source

public static function get_user_application_password( $user_id, $uuid ) {
	$passwords = static::get_user_application_passwords( $user_id );

	foreach ( $passwords as $password ) {
		if ( $password['uuid'] === $uuid ) {
			return $password;
		}
	}

	return null;
}

Changelog

Version Description
5.6.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_password