[wp-trac] [WordPress Trac] #41604: REST API: Attempting to create or update a non-existent setting doesn't return an error response
WordPress Trac
noreply at wordpress.org
Thu Jun 5 11:45:17 UTC 2025
#41604: REST API: Attempting to create or update a non-existent setting doesn't
return an error response
--------------------------------+------------------------------
Reporter: johnbillion | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: rest-api
--------------------------------+------------------------------
Comment (by sheldorofazeroth):
Replying to [ticket:41604 johnbillion]:
> Attempting to create a new setting via a POST request to
`/wp/v2/settings` returns a 200 response, despite the request having been
invalid. The same goes for attempting to update a non-existent setting
with a PUT request.
>
> I would have expected maybe a 400 from such requests.
>
> The internal logic in `WP_REST_Settings_Controller` routes the request
through the `update_item()` method, treats it as a setting update, and
silently ignores the problem.
This same issue persists when an empty body is sent in the update request.
The PR I raised addresses all the cases in which the settings API doesn't
return the expected response. For more details on the issue and the steps
to reproduce it, please go through the description of the pull request.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41604#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list