WordPress at Your Fingertips
function is not described

WP_Application_Passwords::delete_all_application_passwords() public WP 5.6.0

Deletes all application passwords for the given user.

{} It's a method of the class: WP_Application_Passwords{}

Hooks from the method

Return

Int|WP_Error. The number of passwords that were deleted or a WP_Error on failure.

Usage

$result = WP_Application_Passwords::delete_all_application_passwords( $user_id );
$user_id(int) (required)
User ID.

Changelog

Since 5.6.0 Introduced.

Code of WP_Application_Passwords::delete_all_application_passwords() WP 5.8.2

public static function delete_all_application_passwords( $user_id ) {
	$passwords = static::get_user_application_passwords( $user_id );

	if ( $passwords ) {
		$saved = static::set_user_application_passwords( $user_id, array() );

		if ( ! $saved ) {
			return new WP_Error( 'db_error', __( 'Could not delete application passwords.' ) );
		}

		foreach ( $passwords as $item ) {
			/** This action is documented in wp-includes/class-wp-application-passwords.php */
			do_action( 'wp_delete_application_password', $user_id, $item );
		}

		return count( $passwords );
	}

	return 0;
}