[wp-trac] [WordPress Trac] #51748: Allow customization of permission_callback errors
WordPress Trac
noreply at wordpress.org
Tue Nov 10 14:15:26 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: trunk
Severity: normal | Keywords: needs-patch
Focuses: |
-------------------------+-----------------------------
When customizing the REST authentication permission_callback, the method
provided must return one of: true, false or a WP_Error. In the case of
that WP_Error, we are unable to modify the format output from what is
hardcoded in the error_to_response method.
For example, if we would want authentication errors to return the
following JSON object: {auth:false}, it would not be possible since
error_to_response always hardcode the format to code, message and data.
See class-wp-rest-server.php#158
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51748>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list