[wp-trac] [WordPress Trac] #28978: wp_send_json_error() should support WP_Error objects

WordPress Trac noreply at wordpress.org
Sun Aug 3 21:03:25 UTC 2014


#28978: wp_send_json_error() should support WP_Error objects
----------------------------------------+-----------------------------
 Reporter:  danielbachhuber             |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Future Release
Component:  General                     |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+-----------------------------

Comment (by paulschreiber):

 In the attached patch, I tried to emulate what @rmmcue did.

 `wp_send_json_error()` calls `is_wp_error()` on the parameter it was
 passed. If true, it iterates over the object and sets `$result['data']` to
 the just-created array.

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


More information about the wp-trac mailing list