[wp-trac] [WordPress Trac] #43681: Incorrect HTTP status code in 'posts' query.

WordPress Trac noreply at wordpress.org
Mon Jun 16 15:44:35 UTC 2025


#43681: Incorrect HTTP status code in 'posts' query.
-------------------------------------------------+-------------------------
 Reporter:  demitrimuna                          |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  REST API                             |     Version:  4.4
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-test-   |     Focuses:  rest-api
  info                                           |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-testing has-unit-tests => has-patch has-unit-
     tests has-test-info


Comment:

 == Test Report
 === Description
 โœ…This report validates that the indicated patch works as expected.

 Patch tested: https://github.com/WordPress/wordpress-
 develop/pull/8991.diff

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.28
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 137.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-One 2.5
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Testing Instructions
 - As provided in the OP Post
 1. Go to `/wp-json/wp/v2/posts?status=draft`
 2. ๐Ÿž Error 400

 === Expected Results
 1. As per specification, 401 Not Authorized is required for this, Error
 400 is definitely confusing as it doesn't really specify the problem.

 === Actual Results
 1.  โœ… Issue resolved with patch.

 === Additional Notes

 `needs-code-review`

 -  **Important note**: This patch has not been code reviewed, it's only a
 refresh
 - I've added the patch as a GH PR to run the unit test suite. I might be
 updating if required based on the results.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43681#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list