[wp-trac] [WordPress Trac] #51748: Allow customization of permission_callback errors

WordPress Trac noreply at wordpress.org
Tue Nov 10 21:27:21 UTC 2020


#51748: Allow customization of permission_callback errors
-------------------------+------------------------------
 Reporter:  plucmtl      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  REST API     |     Version:  4.7
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+------------------------------

Comment (by TimothyBlynJacobs):

 I'd recommend using the `rest_post_dispatch` or `rest_pre_echo_response`
 filters to modify your `WP_Error` response for your specific requests.

 I don't think we want to support modifying the error response in an
 official manner like that for the reasons I outlined. Additionally, it'd
 be a poor choice since it doesn't have access to the `WP_REST_Request`
 object to ensure this only happens for certain routes.

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


More information about the wp-trac mailing list