wp_is_application_passwords_available_for_user() WordPress Function

The wp_is_application_passwords_available_for_user() function is used to check if the application passwords feature is available for the specified user. This function returns true if the feature is available for the user, false otherwise.

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.


Top ↑

Parameters

$user

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


Top ↑

Return

(bool)


Top ↑

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
5.6.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.

Show More
Show More