Create a user
wp_create_userCreate a new WordPress user account with a specified role and return the user ID plus a generated password if none is supplied. Duplicate logins or emails are refused.
Instructions
Create a new user account with a role. Returns created, id and generated_password (the password made up when none was given, shown only in this answer; null otherwise). A login or email already in use is refused by WordPress, so a repeated call creates no second account. Needs create_users; naming a role needs promote_users, and the role has to be one the account may assign (editable_roles; an unknown role is refused): on multisite only a super admin gives administrator, and an account that is neither a single-site administrator nor a super admin cannot give a role with capabilities it lacks itself. Without a role the user becomes a subscriber. Existing accounts change with wp_update_user. No undo point is recorded.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"username": "<username>",
"email": "<email>"
},
"name": "wp_create_user"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | No | Role slug, e.g. editor. Default "subscriber". | |
| Yes | Email address; an invalid one is refused. | ||
| password | No | Password. Omitted: a 20-character password is generated and returned once as generated_password. | |
| username | Yes | Login name; WordPress strips characters it does not allow in usernames. | |
| last_name | No | Optional last name. | |
| first_name | No | Optional first name. |