[wp-trac] [WordPress Trac] #58255: wp_send_json_error should respect error state passed in WP_Error.

WordPress Trac noreply at wordpress.org
Thu May 25 12:45:19 UTC 2023


#58255: wp_send_json_error should respect error state passed in WP_Error.
--------------------------------------+------------------------------
 Reporter:  spacedmonkey              |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Administration            |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+------------------------------

Comment (by danielbachhuber):

 I'm not opposed to it, but I'm not sure how much value it provides.

 One backwards compat concern: If someone is already passing a `WP_Error`
 object into `wp_send_json_error()`, this would change the behavior.

 Additionally, 'status' is a magical property of REST API errors. If we
 were to introduce this new behavior, we may want to formalize that in some
 way.

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


More information about the wp-trac mailing list