How to create a WordPress application password
An application password lets a program use your WordPress site without knowing your real password. This guide is for site owners and developers. You will create one, use it for REST API access, narrow down the usual errors, and revoke it again.
Contents
What an application password is
Application passwords are part of WordPress core since version 5.6. Each one is 24 characters long, belongs to exactly one user account and has a name that tells you who uses it. A program signs in to the REST API with it. Your normal password stays private, and you can revoke each application password on its own. WordPress also shows when and from which IP address a password was last used.
An application password has the same permissions as its account. WordPress cannot limit it to single areas. If you create one for an administrator, the program has administrator rights.
Requirements
- WordPress 5.6 or newer.
- The site runs over HTTPS. By default WordPress offers application passwords only on HTTPS sites or in a local environment.
- The feature is not switched off. A plugin or custom code can disable it with the
wp_is_application_passwords_availablefilter. - The REST API is reachable. Open
https://your-domain.com/wp-json/in a browser. You should see JSON, not an error page.
Create an application password
- Sign in to WordPress with the account the password should belong to. As an administrator you can also edit another account under Users → All Users.
- Open Users → Profile and scroll to the Application Passwords section.
- Enter a name you will recognise later, for example the name of the program.
- Click Add New Application Password.
- Copy the password right away. WordPress shows it only once. It consists of six blocks of four characters, like
xxxx xxxx xxxx xxxx xxxx xxxx. You can keep or drop the spaces.
Do not send the password by email or chat. Enter it directly where it is needed. If you lose it, revoke it and create a new one.
Use it for REST API access
The program sends the username and the application password with HTTP Basic Authentication. Use the login name, not the display name. Over HTTPS this works for REST API requests. A test with curl looks like this:
curl --user USERNAME https://your-domain.com/wp-json/wp/v2/users/me?context=edit
curl then asks for the password. Paste the application password there, so it does not end up in your shell history.
If the answer is JSON with your user data, the login works. The WordPress REST API handbook describes Basic Authentication with application passwords in the same way.
Give the account only the permissions it needs
Create a separate WordPress account for each external service instead of using your personal one. Then the revisions show which changes came from there, and you can cut off access without touching anyone’s own login.
Pick the smallest role that does the job. If the program only edits pages and posts, the Editor role is usually enough. An administrator is rarely needed. To keep application passwords away from certain users, a site can also use the wp_is_application_passwords_available_for_user filter.
Fix application password problems
- Application passwords not showing in the profile
- The Application Passwords section appears only when the feature is available. Check three things. First, the site must use HTTPS: under Settings → General, both addresses should start with
https://. Second, a security plugin or custom code may have disabled the feature. Third, it may be switched off for your account only. In that case ask the site administrator. You can also open/wp-json/and look at theauthenticationkey. If it is empty, WordPress has not made application passwords available for that request. - Application passwords are not available
- This is the message WordPress returns when the feature is off for the whole site: “Application passwords are not available.” If you see “Application passwords are not available for your account”, it is off for that one user. Both are decisions made by the site, not by the program you connect. A security plugin, a managed hosting setting or code in a theme or a plugin can be the cause. Look in your security plugin for options about the REST API or application passwords, or ask your host.
- How do I enable application passwords when they are disabled?
- Find out what disabled them. A plugin or code using
add_filter( 'wp_is_application_passwords_available', '__return_false' )turns the feature off, and removing that or changing its plugin setting turns it back on. On a site without HTTPS, set up HTTPS first. WordPress documents__return_trueon that filter to force the feature without SSL, but that exposes the password to anyone on the network, so use it only for testing. A local development site is an exception. WordPress treats it as available whenWP_ENVIRONMENT_TYPEis set tolocal. - Application password not working: the login is rejected
- WordPress answers “The provided password is an invalid application password” when the user exists but no stored password matches. Usually the cause is a typo or a revoked password. Use the login name, not the display name, and create a fresh password if in doubt. “Unknown username” points to a wrong username instead. If everything is correct and requests still fail, the server may be dropping the login header or a security plugin may block REST API logins.
- The server seems to drop the Authorization header
- WordPress reads the username and password of a Basic Authentication request from the server variables
PHP_AUTH_USERandPHP_AUTH_PW. The.htaccessfile that WordPress writes contains the lineRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}], which hands the Authorization header on to PHP. If you or a plugin replaced that file, check that the line is still inside the WordPress block, directly afterRewriteEngine On. If it is there and the login still fails, ask your host whether the web server or a proxy removes the header. - The REST API returns an error or a blocked page
- Open
https://your-domain.com/wp-json/in a private browser window. Password protection in front of the whole site, a maintenance mode or a firewall rule for/wp-json/blocks every program that uses application passwords, however correct the password is. Lift the block for the REST API or allow the connecting program. - Is an application password safe?
- It is safer than sharing your main password. It can be revoked on its own, and WordPress shows when it was last used. It still carries all rights of its account, so treat it like a key: store it in one place, use a restricted account and revoke it when you stop using the program.
Revoke an application password
- Open Users → Profile for the account in WordPress.
- Find the entry in the Application Passwords section and click Revoke.
- To cut off every program at once, use Revoke all application passwords.
From then on WordPress rejects every request that uses the revoked password. If the WordPress account is deleted, its application passwords stop working too.