wp_update_user
Change a WordPress user's editable fields (name, email, roles, password, URL, description) with a dry-run preview, then apply only when confirmed.
Instructions
Change an existing user's fields.
fields is an object; the editable keys are name, email, roles, password, url,
description - ANY OTHER KEY IS REFUSED (WordPress silently ignores unknown fields,
which would report a change that never happened). username is not editable.
Setting roles REPLACES the user's roles, so passing ['subscriber'] on an
administrator demotes them. A password here is a real password reset: the user's
old password stops working immediately, and the new one is masked in the preview
exactly as in wp_create_user. An empty fields is refused rather than reported as
a successful no-op. DEFAULTS TO dry_run=true (returns a preview; writes nothing).
Pass dry_run=false to apply. Requires the REST transport and an administrator app
password. Prod writes require allow_prod=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | Yes | ||
| dry_run | No | ||
| install | Yes | ||
| user_id | Yes | ||
| allow_prod | No |