[wp-trac] [WordPress Trac] #36271: Trigger _doing_it_wrong if wp_send_json is used on a REST API request

WordPress Trac noreply at wordpress.org
Fri Mar 18 07:24:20 UTC 2016


#36271: Trigger _doing_it_wrong if wp_send_json is used on a REST API request
-------------------------+-----------------------------
 Reporter:  rmccue       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:
 Severity:  normal       |   Keywords:  needs-patch
  Focuses:               |
-------------------------+-----------------------------
 We should heavily discourage users from using wp_send_json (& co.) on REST
 API requests. Two changes I want to make:

 1. If `_doing_it_wrong` is triggered on a REST request, we should add a
 header ala the `_deprecated_function` headers.
 2. If `wp_send_json` is called on a REST request, we should trigger a
 `_doing_it_wrong` and point people towards `WP_REST_Response` and
 `WP_Error`

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36271>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list