Wordpress - REST API - How to set up roles
Wordpress REST API allows roles as array.
But when you try to set roles as it is, it throws error.
Correct list of roles:
- administrator
- editor
- author
- contributor
- subscriber
- customer
As you see, all of these role names must be in lower case.
For example:
$user = WordpressAPI::createUser([
'username' => 'test',
'email' => 'test@gmail.com',
'password' => '123456QQQ',
'roles' => ['subscriber']
]);
And you can add your own roles that you created in system.
Comments