0

When I hit: https://example.com/wp-json/wp/v2/users

I am getting response:

{
"code": "rest_user_cannot_view",
"message": "Sorry, you are not allowed to list users.",
"data": {
"status": 401
}
}

I am able to view users in admin and via REST API I can create and modify posts so I am authenticated but for some reason I am unable to list users. This user has administrator role.

Anyone know what issue could be?

1
  • Are you authenticated to the REST API before attempting to see the users? Being logged in to wp-admin doesn't necessarily mean you've authenticated to the REST API.
    – Pat J
    Aug 21 '21 at 18:44
2

I discovered it was wordfence plugin. It blocks this endpoint.

You can disable it with this option:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.