wp_is_application_passwords_available()WP 5.6.0

Checks if Application Passwords is globally available.

By default, Application Passwords is available to all sites using SSL or to local environments. Use the wp_is_application_passwords_available filter to adjust its availability.

Hooks from the function

Return

true|false.

Usage

wp_is_application_passwords_available();

Examples

0

#1 Example of returning an error on an inappropriate request

Suppose we make a request and in the REST listener we need to check if the request fits the application Password system and if it doesn't, we need to print the corresponding error message.

if ( ! wp_is_application_passwords_available() ) {

	return new WP_Error(
		'application_passwords_disabled',
		__( 'Application passwords are not available.' ),
		[ 'status' => 501 ]
	);
}

Changelog

Since 5.6.0 Introduced.

wp_is_application_passwords_available() code WP 6.5.2

function wp_is_application_passwords_available() {
	/**
	 * Filters whether Application Passwords is available.
	 *
	 * @since 5.6.0
	 *
	 * @param bool $available True if available, false otherwise.
	 */
	return apply_filters( 'wp_is_application_passwords_available', wp_is_application_passwords_supported() );
}