diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index d14aefb1f6308..a2008d0f6d50e 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -920,7 +920,7 @@ public function update_item( $request ) { return new WP_Error( 'rest_comment_invalid_post_id', __( 'Invalid post ID.' ), - array( 'status' => 403 ) + array( 'status' => 404 ) ); } } diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php index 547757ae6042e..e80758eab695a 100644 --- a/tests/phpunit/tests/rest-api/rest-comments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php @@ -2821,7 +2821,7 @@ public function test_update_comment_invalid_post_id() { $request->set_param( 'post', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ); $response = rest_get_server()->dispatch( $request ); - $this->assertErrorResponse( 'rest_comment_invalid_post_id', $response, 403 ); + $this->assertErrorResponse( 'rest_comment_invalid_post_id', $response, 404 ); } public function test_update_comment_invalid_permission() {