List users
list_usersRetrieve WordPress users with search, role filters, sorting, and pagination. Returns public profiles unless the requester has administrator capabilities, then includes emails and roles.
Instructions
List users with search, role filtering, ordering and pagination. Email addresses and roles are only returned when the authenticated user has list_users capability (Administrator); otherwise WordPress returns just the public author profile.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Which page of results to return. | |
| order | No | Sort direction. | asc |
| roles | No | Filter by role slugs, e.g. ["editor", "author"]. Administrator only. | |
| search | No | Match against name, username, email and slug. | |
| orderby | No | Which field to sort by. | name |
| site_id | No | Which configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids. | |
| per_page | No | How many results per page. | |
| has_published_posts | No | Only users who have published content. |