> For the complete documentation index, see [llms.txt](https://docs.planetcrust.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.planetcrust.com/human-connections/wordpress/wordpress/action-update-user.md).

# Action: Update User

<p align="center"><a class="button primary" data-icon="circle-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscriptions</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>

<figure><img src="/files/gN6vhLq50JgfXfhu0lk5" alt="" width="375"><figcaption></figcaption></figure>

<p align="center">The Update User action modifies the details, role, or metadata of an existing user.</p>

{% embed url="<https://www.youtube.com/watch?v=CyuUuaBSZzA>" %}

#### Example User Story

I want to update user details in WordPress so that I can manage user information effectively.

#### Fields

| Field Name | Field Type | Required |
| ---------- | ---------- | -------- |
| userId     | Integer    | Yes      |
| email      | String     | No       |
| username   | String     | No       |
| firstName  | String     | No       |
| lastName   | String     | No       |
| roles      | String     | No       |

### Related Connections

[WordPress](/human-connections/wordpress/wordpress.md)

### Related Automations

Example link

### Code (Apache v2.0): Operation

```
{
  "handle": "update-user",
  "state": "inDev",
  "meta": {
    "short": "Update User",
    "description": "Updates an existing user in WordPress."
  },
  "input": [
    {
      "name": "userId",
      "type": "Integer",
      "required": true,
      "meta": {
        "description": "The ID of the user to update."
      }
    },
    {
      "name": "email",
      "type": "String",
      "required": false,
      "meta": {
        "description": "The email address of the user."
      }
    },
    {
      "name": "username",
      "type": "String",
      "required": false,
      "meta": {
        "description": "The username of the user."
      }
    },
    {
      "name": "firstName",
      "type": "String",
      "required": false,
      "meta": {
        "description": "The first name of the user."
      }
    },
    {
      "name": "lastName",
      "type": "String",
      "required": false,
      "meta": {
        "description": "The last name of the user."
      }
    },
    {
      "name": "roles",
      "type": "String",
      "required": false,
      "meta": {
        "description": "The roles assigned to the user."
      }
    }
  ],
  "output": [
    {
      "name": "id",
      "type": "Integer",
      "selector": ["id"],
      "meta": {
        "description": "The ID of the updated user."
      }
    },
    {
      "name": "email",
      "type": "String",
      "selector": ["email"],
      "meta": {
        "description": "The email address of the updated user."
      }
    },
    {
      "name": "username",
      "type": "String",
      "selector": ["username"],
      "meta": {
        "description": "The username of the updated user."
      }
    },
    {
      "name": "firstName",
      "type": "String",
      "selector": ["first_name"],
      "meta": {
        "description": "The first name of the updated user."
      }
    },
    {
      "name": "lastName",
      "type": "String",
      "selector": ["last_name"],
      "meta": {
        "description": "The last name of the updated user."
      }
    },
    {
      "name": "roles",
      "type": "String",
      "selector": ["roles"],
      "meta": {
        "description": "The roles assigned to the updated user."
      }
    }
  ],
  "steps": [
    {
      "type": "http",
      "http": {
        "method": "POST",
        "path": "/wp-json/wp/v2/users/{{userId}}",
        "headers": {
          "Content-Type": "application/json"
        },
        "bodyTemplate": {
          "value": "{\"email\":\"{{email}}\",\"username\":\"{{username}}\",\"first_name\":\"{{firstName}}\",\"last_name\":\"{{lastName}}\",\"roles\":[\"{{roles}}\"]}",
          "placeholders": [
            {
              "name": "email",
              "type": "String",
              "description": "The email address of the user.",
              "required": false
            },
            {
              "name": "username",
              "type": "String",
              "description": "The username of the user.",
              "required": false
            },
            {
              "name": "firstName",
              "type": "String",
              "description": "The first name of the user.",
              "required": false
            },
            {
              "name": "lastName",
              "type": "String",
              "description": "The last name of the user.",
              "required": false
            },
            {
              "name": "roles",
              "type": "String",
              "description": "The roles assigned to the user.",
              "required": false
            }
          ]
        }
      }
    }
  ]
}

```

<p align="center"><a class="button primary" data-icon="square-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.planetcrust.com/human-connections/wordpress/wordpress/action-update-user.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
