Automattic / Automattic/wordpress-rs
Handle wp_error for /wp-json
- Dominant language
- Rust
- Stars
- 36
- Forks
- 5
- Avg merge
- 17h 30m
- Merged PRs (30d)
- 43
Description
There are plugins that emit a `WP_Error ` when the REST API is disabled. This is pretty standard behaviour (return a valid response shape, or else a `WP_Error`) for the rest of the API, so we should handle it as an application-level error in the library.
Here are two example responses:
```json
{
"code": "rest_forbidden",
"message": "REST API access is restricted.",
"data": {
"status": 403
}
}
```
```json
{
"code": "rest_not_logged_in",
"message": "You are not currently logged in.",
"data": {
"status": 401
}
}
```
Example Plugins:
- https://wordpress.org/plugins/disable-json-api/
- https://wordpress.org/plugins/disable-wp-rest-api/
For login specifically, we should have the ability to scan the `code` field and have a list of signatures (similar to what we use for the list of plugins that block Application Passwords) and tie that back to a specific plugin so we can tell the user "You have plugin xxxx installed, and the JSON API is disabled because of it. You'll need to disable this plugin to use the app"
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.