mirror of
https://gh.wpcy.net/https://github.com/wp-cli/handbook.git
synced 2026-04-27 02:46:16 +08:00
52 lines
1.9 KiB
Markdown
52 lines
1.9 KiB
Markdown
# wp user application-password
|
|
|
|
Creates, updates, deletes, lists and retrieves application passwords.
|
|
|
|
### EXAMPLES
|
|
|
|
# List user application passwords and only show app name and password hash
|
|
$ wp user application-password list 123 --fields=name,password
|
|
+--------+------------------------------------+
|
|
| name | password |
|
|
+--------+------------------------------------+
|
|
| myapp | $P$BVGeou1CUot114YohIemgpwxQCzb8O/ |
|
|
+--------+------------------------------------+
|
|
|
|
# Get a specific application password and only show app name and created timestamp
|
|
$ wp user application-password get 123 6633824d-c1d7-4f79-9dd5-4586f734d69e --fields=name,created
|
|
+--------+------------+
|
|
| name | created |
|
|
+--------+------------+
|
|
| myapp | 1638395611 |
|
|
+--------+------------+
|
|
|
|
# Create user application password
|
|
$ wp user application-password create 123 myapp
|
|
Success: Created application password.
|
|
Password: ZG1bxdxdzjTwhsY8vK8l1C65
|
|
|
|
# Only print the password without any chrome
|
|
$ wp user application-password create 123 myapp --porcelain
|
|
ZG1bxdxdzjTwhsY8vK8l1C65
|
|
|
|
# Update an existing application password
|
|
$ wp user application-password update 123 6633824d-c1d7-4f79-9dd5-4586f734d69e --name=newappname
|
|
Success: Updated application password.
|
|
|
|
# Delete an existing application password
|
|
$ wp user application-password delete 123 6633824d-c1d7-4f79-9dd5-4586f734d69e
|
|
Success: Deleted 1 of 1 application password.
|
|
|
|
# Check if an application password for a given application exists
|
|
$ wp user application-password exists 123 myapp
|
|
$ echo $?
|
|
1
|
|
|
|
# Bash script for checking whether an application password exists and creating one if not
|
|
if ! wp user application-password exists 123 myapp; then
|
|
PASSWORD=$(wp user application-password create 123 myapp --porcelain)
|
|
fi
|
|
|
|
|
|
|
|
|