Title: WP_Application_Passwords::get_user_application_passwords
Published: December 9, 2020
Last modified: August 20, 2026

---

# WP_Application_Passwords::get_user_application_passwords( int $user_id ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#changelog)

Gets a user’s application passwords.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#parameters)󠁿

 `$user_id`intrequired

User ID.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#return)󠁿

 array The list of application passwords.

 * `...$0` array
    - `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](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#source)󠁿

    ```php
    public static function get_user_application_passwords( $user_id ) {
    	$passwords = get_user_meta( $user_id, static::USERMETA_KEY_APPLICATION_PASSWORDS, true );

    	if ( ! is_array( $passwords ) ) {
    		return array();
    	}

    	$save = false;

    	foreach ( $passwords as $i => $password ) {
    		if ( ! isset( $password['uuid'] ) ) {
    			$passwords[ $i ]['uuid'] = wp_generate_uuid4();
    			$save                    = true;
    		}
    	}

    	if ( $save ) {
    		static::set_user_application_passwords( $user_id, $passwords );
    	}

    	return $passwords;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-application-passwords.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-application-passwords.php#L175)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-application-passwords.php#L175-L196)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_generate_uuid4()](https://developer.wordpress.org/reference/functions/wp_generate_uuid4/)`wp-includes/functions.php` |

Generates a random UUID (version 4).

  | 
| [get_user_meta()](https://developer.wordpress.org/reference/functions/get_user_meta/)`wp-includes/user.php` |

Retrieves user meta field for a user.

  |

| Used by | Description | 
| [WP_REST_Application_Passwords_Controller::get_items()](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_items/)`wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php` |

Retrieves a collection of application passwords.

  | 
| [wp_authenticate_application_password()](https://developer.wordpress.org/reference/functions/wp_authenticate_application_password/)`wp-includes/user.php` |

Authenticates the user using an application password.

  | 
| [WP_Application_Passwords_List_Table::prepare_items()](https://developer.wordpress.org/reference/classes/wp_application_passwords_list_table/prepare_items/)`wp-admin/includes/class-wp-application-passwords-list-table.php` |

Prepares the list of items for displaying.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_passwords/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_application_passwords%2Fget_user_application_passwords%2F)
before being able to contribute a note or feedback.