Security PHP Beginner

Disable Application Passwords

Turn off application passwords, which let apps access your site through the REST API, if nothing on your site uses them.

Tested on WordPress 7.1 PHP 8.3 No plugin needed Updated
functions.php 1 lines
add_filter( 'wp_is_application_passwords_available', '__return_false' );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

Application passwords let external apps, scripts and services sign in to the REST API on a user’s behalf without their main password. If nothing on your site uses them, they’re one more way in for an attacker who gets into an account.

How it works

Returning false from wp_is_application_passwords_available removes the Application Passwords section from every user profile and makes WordPress reject them for authentication. Existing application passwords stop working straight away.

Things to watch

  • Some tools need application passwords, including the WordPress mobile app on self-hosted sites, Zapier-style integrations and some deployment and backup services. Check before you turn them off.
  • To keep them for administrators only, use the wp_is_application_passwords_available_for_user filter and return user_can( $user, 'manage_options' ).

How to test it

Open Users → Profile. The Application Passwords section should be gone.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only