Cookbook › WP-CLI
Add a user or change a role with WP-CLI
Paste into ChatGPT or ClaudeUse WP-CLI to create a user “maria” with the email maria@example.com and the Editor role. Then list all editors.
Changes your site. Standard asks you first in wp-admin; Trusted does it directly.
What happens
Section titled “What happens”- Your assistant runs
wp user create maria maria@example.com --role=editor. - WordPress creates the account. Maria sets her own password with “Lost your password?” on the login page.
- It runs
wp user list --role=editorto show the result.
Try also
Section titled “Try also”- “Make Sam an Author instead of an Editor.”
- “Delete the user ‘test’ and give their posts to Maria.”
Good to know
Section titled “Good to know”- The WordPress user your assistant acts as needs permission to manage users.
- Passwords are never shown or set by your assistant.