Cannot update user role through REST API (rest_user_invalid_role)

[ad_1]

Hello, I have created a custom role named ‘User Manager’, which is used only to run REST API calls. Custom role allows creating users (it works) and should also update user roles (doesn’t work)

User Manager granted rights:

Read
Create Roles	
Create Users	
Delete Roles	
Delete Users	
Edit Roles	
Edit Users	
List Roles	
List Users	
Promote Users	
Remove Users
ure_edit_roles

When creating a user as for endpoint /wp/v2/users, WITHOUT specifying user role, the user creation will succeed, and user will be created with role ‘subscriber’.

As soon as user creation will include the roles parameter, an error is thrown:

http returned code: rest_user_invalid_role
http returned text; Sorry, you are not allowed to give users that role
status: 403

The error seems to be fired here

What permission are missing in your opinion?

  • This topic was modified 46 minutes ago by Blutarsky.
  • This topic was modified 38 minutes ago by Blutarsky.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer