WP_Application_Passwords::application_name_exists_for_user() WordPress Method

The WP_Application_Passwords::application_name_exists_for_user() method checks if an application name exists for a given user.

WP_Application_Passwords::application_name_exists_for_user( int $user_id, string $name ) #

Checks if an application password with the given name exists for this user.


Parameters

$user_id

(int)(Required)User ID.

$name

(string)(Required)Application name.


Top ↑

Return

(bool) Whether the provided application name exists.


Top ↑

Source

File: wp-includes/class-wp-application-passwords.php

	public static function application_name_exists_for_user( $user_id, $name ) {
		$passwords = static::get_user_application_passwords( $user_id );

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

		return false;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.