Skip to content

rest_cannot_create_user - know how to allow rest to create users?  #35

@amityweb

Description

@amityweb

I know this is probably not related to code on here, but I can't find a solution online.

Using this code:

$user = [
    'username' => 'myusername',  
    'email' => '[email protected]',
    'password' => 'password',
];
$wordpress = wpClient();
$user = $wordpress->users()->save($user);

I get this error:

Client error: `POST https://mysite.co.uk/wp-json/wp/v2/users` resulted in a `401 Unauthorized` response:
{"code":"rest_cannot_create_user","message":"Sorry, you are not allowed to create new users.","data":{"status":401}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions