[wp-trac] [WordPress Trac] #42828: Hard-coded 403 status in REST response should use `rest_authorization_required_code()`

WordPress Trac noreply at wordpress.org
Sat Dec 30 20:36:27 UTC 2017


#42828: Hard-coded 403 status in REST response should use
`rest_authorization_required_code()`
--------------------------+--------------------------
 Reporter:  jaswrks       |       Owner:  rachelbaker
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  4.9.2
Component:  REST API      |     Version:  4.7
 Severity:  normal        |  Resolution:  fixed
 Keywords:  commit        |     Focuses:  rest-api
--------------------------+--------------------------
Changes (by rachelbaker):

 * owner:   => rachelbaker
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"42421"]:
 {{{
 #!CommitTicketReference repository="" revision="42421"
 REST API: Return the proper status code for failed permission callbacks in
 `WP_REST_Server->dispatch()`.

 Use the `rest_authorization_required_code()` function to return a 401
 status code when a permission callback fails due to a user not being
 logged in.

 Props jaswrks.
 Fixes #42828.
 }}}

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


More information about the wp-trac mailing list