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

Popular posts from this blog

CSS Как прикрепить слой (div) к краю

MySQL - How to add JSON column type

Как сделать заголовок модуля активной ссылкой в Joomla 1.5