WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

XML-RPC WordPress API/Users

wp.getUsersBlogs

Retrieve list of blogs for this user.

Parameters

  • string username
  • string password

Return Values

  • array
    • struct
      • string blogid
      • string blogName
      • string url
      • string xmlrpc: XML-RPC endpoint for the blog.
      • bool isAdmin

wp.getUser

Retrieve a user.

Added in WordPress 3.5.

Parameters

  • int blog_id
  • string username
  • string password
  • int user_id
  • array fields: Optional. List of field or meta-field names to include in response.

Return Values

  • struct: Note that the exact fields returned depends on the fields parameter.
    • string user_id
    • string username1
    • string first_name
    • string last_name
    • string bio
    • string email1
    • string nickname
    • string nicename1
    • string url
    • string display_name1
    • datetime registered1
    • roles

1 basic meta-field

Errors

  • 401
    • If user does not have permission to edit the user.
  • 404
    • If no user with that user_id exists.

Filters

xmlrpc_default_user_fields

The default set of fields to be returned can be controlled using the xmlrpc_default_user_fields filter. The default value for this filter is:

array( 'all' )

xmlrpc_prepare_user

Immediately before returning the prepared user data, the value is passed through the xmlrpc_prepare_user filter. The filter has three parameters:

  1. The prepared user data about to be returned
  2. The original user WP_User object, see get_userdata.
  3. The fields parameter value.

wp.getUsers

Retrieve list of users.

Added in WordPress 3.5.

Parameters

  • int blog_id
  • string username
  • string password
  • struct filter: Optional.
    • string role: Restrict results to only users of a particular role.
    • string who: If 'authors', then will return all non-subscriber users.
    • int number
    • int offset
    • string orderby
    • string order
  • array fields: Optional. See #wp.getUser.

Return Values

Notes

  • Response will only contain users that the user has permission to edit. Therefore, there may be fewer than filter['number'] users in the response.

Errors

  • 401
  • 403
    • If invalid role is specified.

Filters

Supports same filters as #wp.getUser.


wp.getProfile

Retrieve profile of the requesting user.

Added in WordPress 3.5.

Parameters

  • int blog_id
  • string username
  • string password
  • array fields: Optional. See #wp.getUser.

Return Values

Errors

  • 401
    • If the user does not permission to edit his/her profile.

Filters

Supports same filters as #wp.getUser.


wp.editProfile

Edit profile of the requesting user.

Added in WordPress 3.5.

Parameters

  • int blog_id
  • string username
  • string password
  • struct content
    • string first_name
    • string last_name
    • string url
    • string display_name
    • string nickname
    • string nicename
    • string bio

Return Values

  • bool true

Errors

  • 401
    • If the user does not permission to edit his/her profile.

Notes

It is not possible to change a user's password, email address, or roles via wp.editProfile. For those actions, the user must use the standard WordPress admin interface.


wp.getAuthors

Retrieve list of all users.

Parameters

  • int blog_id
  • string username
  • string password

Return Values

  • array
    • struct
      • string user_id
      • string user_login
      • string display_name

Errors

Notes

Because this method will return a list of all users, including subscribers, it may be preferable to use wp.getUsers instead, specifying 'authors' for the 'who' parameter to limit the results to users who are legitime authors.