Add support for `WP_Error` objects passed to `wp_send_json_error()`. The error object gets output as an array of error codes and messages, rather than as an empty object.

Fixes #28978
Props paulschreiber


git-svn-id: https://develop.svn.wordpress.org/trunk@30506 602fd350-edb4-49c9-b593-d223f7449a82