wp_is_application_passwords_available_for_user( int|WP_User $user )

Checks if Application Passwords is available for a specific user.

Description

By default all users can use Application Passwords. Use ‘wp_is_application_passwords_available_for_user’ to restrict availability to certain users.

Parameters

$user

(int|WP_User) (Required) The user to check.

Return

(bool)

Source

File: wp-includes/user.php

function wp_is_application_passwords_available_for_user( $user ) {
	if ( ! wp_is_application_passwords_available() ) {
		return false;
	}

	if ( ! is_object( $user ) ) {
		$user = get_userdata( $user );
	}

	if ( ! $user || ! $user->exists() ) {
		return false;
	}

	/**
	 * Filters whether Application Passwords is available for a specific user.
	 *
	 * @since 5.6.0
	 *
	 * @param bool    $available True if available, false otherwise.
	 * @param WP_User $user      The user to check.
	 */
	return apply_filters( 'wp_is_application_passwords_available_for_user', true, $user );
}

Changelog

Version Description
5.6.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_is_application_passwords_available_for_user