Three reviews. Three questions. wordpress.org review sent our plugins back three times for REST permissions: once for who may call a route, once for which object, once for how much came back. This module turns those reviews into a checklist.
| Course | WordPress REST API Course ยท Module 4 of 9 ยท Stage 2 "Build your own" |
| Learn | Cookie + nonce, Application Passwords, permission_callback with capabilities, object-level checks, response scope |
| How | Three real review rounds (4WP Drive, 4WP TODO), the fixes that passed, interview questions after every lesson |
Three questions before every route
flowchart LR
A["Who may call it?<br/>401 ยท guest"] --> B["Which object?<br/>403 ยท edit_post on post_id"]
B --> C["How much comes back?<br/>only what the user may see"]
classDef q fill:#feebeb,stroke:#f93e3e,color:#1e293b
class A,B,C q
Authenticated is not authorized. Check the user, then the object, then the response.
Before โ after
| Before | After Module 4 |
|---|---|
Global edit_posts on every route | capabilities from the post type of the import |
Access to the plugin = access to any post_id | edit_post on the target object |
| A list of all users in the response | only data the user can already see |
| 401 and 403 treated the same | 401 not logged in ยท 403 logged in, not allowed |
You'll be able to answer
- What is the difference between 401 and 403 in WordPress REST?
- How do you check permissions for a specific object in permission_callback?
- How does an external script authenticate to the WordPress REST API?