How to fix WPCLI Error: Role doesn't exist: admin
Problem:
While trying to create a user using wpcli using a command such as
wp_user_create.sh
wp user create uli [email protected] --role=admin --user_pass=abc123abcyou see the following error message:
error.txt
Error: Role doesn't exist: adminSolution
Run
wp_role_list.sh
wp role listto list all roles. By default, these roles are:
output.txt
+---------------+---------------+
| name | role |
+---------------+---------------+
| Administrator | administrator |
| Editor | editor |
| Author | author |
| Contributor | contributor |
| Subscriber | subscriber |
| SEO Manager | wpseo_manager |
| SEO Editor | wpseo_editor |
+---------------+---------------+You have to use the value from the second column in the wp user create command.
For example, in order to create an admin user, use --role=administrator, e.g.:
wp_user_create.sh
wp user create uli [email protected] --role=administrator --user_pass=abc123abcCheck out similar posts by category:
Wordpress
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow