[wp-trac] [WordPress Trac] #65050: REST API: Comments controller returns 403 instead of 404 for invalid post ID in update_item()
WordPress Trac
noreply at wordpress.org
Thu Apr 9 10:34:26 UTC 2026
#65050: REST API: Comments controller returns 403 instead of 404 for invalid post
ID in update_item()
-------------------------------------+-------------------------------
Reporter: saratheonline | Owner: saratheonline
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: coding-standards
-------------------------------------+-------------------------------
Changes (by gaurangsondagar):
* focuses: => coding-standards
Comment:
Tested patch: https://github.com/WordPress/wordpress-develop/pull/11529
Environment:
- WordPress: 7.1-alpha-62161-src
- PHP: 8.3.30
- Browser: Chrome
- Database: MySQL 8.4.8
- OS: Ubuntu
Steps I followed:
- Confirmed that 'update_item()' in 'WP_REST_Comments_Controller' returns
a 403 status when an invalid post ID is provided.
- Verified that the same scenario in `get_item()` correctly returns a 404
status.
- This creates inconsistency within the same controller.
Agree that 404 is the correct response here, as the post does not exist
and this is not a permission issue.
Tested the proposed fix and it resolves the issue as expected without
introducing any regressions.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65050#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list