admin管理员组

文章数量:1122832

I have to get following error on the localhost

"code":"application_passwords_disabled"

  • Server & Apache: Xampp v3.2.4
  • OP: Win 10 64Bit
  • WP: v5.6.1

I have to get following error on the localhost

"code":"application_passwords_disabled"

  • Server & Apache: Xampp v3.2.4
  • OP: Win 10 64Bit
  • WP: v5.6.1
Share Improve this question asked Feb 12, 2021 at 6:45 km onurkm onur 1592 silver badges6 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 16

That error could happen if wp_is_application_passwords_available() returns a false, and the docs says:

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

So, to enable the Application Passwords:

  • Enable SSL on your localhost,

  • Or define WP_ENVIRONMENT_TYPE either as a global system variable or constant, and set its value to local:

    // Example when defining it as a constant.
    define( 'WP_ENVIRONMENT_TYPE', 'local' );
    
  • Or use the wp_is_application_passwords_available hook like so:

    add_filter( 'wp_is_application_passwords_available', '__return_true' );
    

if you tried the above answer and it didn't work for you try this 1- add this to the wp-config.php

define( 'WP_ENVIRONMENT_TYPE', 'staging' );

2- go to /MAMP/htdocs/your-site-folder/wp-content/themes/your-theme/function.php, and add this line

add_filter( 'wp_is_application_passwords_available', '__return_true' );

it worked with me after doing the second step, note that I am using Mamp

When you try to edit a user and enable application password, you will get this message:

The application password feature requires HTTPS, which is not enabled on this site.

If this is a development website you can set the environment type accordingly to enable **Application Passwords**. 

and if you follow the provided link, you will go to WP_ENFIRONMENT_TYPE, section of wp-config.php, and you have the option to set it to one of the following values: local, development, staging, or production.

For me, I could only enable Application Passwords by adding the following line to wp-config.php:

`define('WP_ENVIRONMENT_TYPE', 'local');`

I thought development would work, but it did not. Anyways, try different values and see which works best for you.

本文标签: errorsApplication passwords not working on localhost