Allow custom user types to access WP REST API #736
Closed
brachypelma
started this conversation in
Feature Requests
Replies: 1 comment
-
Closing this after learning more about API authentication/PP-Capabilities. The issue I was facing pertained to authenticating calls to a custom API endpoint established by a third-party plugin. After reviewing the source code for the latter, I determined how I could resolve my issue by setting user role capabilities for custom roles in the PP-Capabilities plugin. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First, I want to say that I appreciate all the work that must have gone into making this tool and that you have put it out there for us to use.
Second, I want to apologize in advance if this is not the right place to post this. I am not sure whether this is an issue with this plugin, or with WordPress more generally. If it is the latter, I would appreciate any help anyone is willing to offer to point me in the right direction.
I am a recent adoptee of the PP-Capabilities plugin. A site I am working on has some custom roles configured that limit access to only certain post types, etc.
When I logged in as one of these restricted access custom users, I noticed that attempts to use any of the blocks that call the WordPress REST API in the Gutenberg editor (the query block, e.g.) failed with the following 403 response:
{"code":"rest_forbidden","message":"Sorry, you are not allowed to do that.","data":{"status":403}}
Admins and editors (default user types) are able to call the REST API when authoring these blocks in Gutenberg, but custom user types created with PP-Capabilities are not.
Is there a way to modify access to the REST API on a per-role basis? I searched the documentation and plugin UI, but couldn't find anything. Otherwise, is there a simple way to do this in my theme code, e.g. with a REST API hook? My search for such a solution didn't yield anything that helped me.
Thanks again for any help you may be able to offer.
Beta Was this translation helpful? Give feedback.
All reactions