[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
Tue Jul 7 13:19:12 UTC 2020
#36271: Trigger _doing_it_wrong if wp_send_json is used on a REST API request
-------------------------+---------------------------
Reporter: rmccue | Owner: spacedmonkey
Type: enhancement | Status: closed
Priority: normal | Milestone: 5.5
Component: REST API | Version: 4.4
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses:
-------------------------+---------------------------
Comment (by spacedmonkey):
I would not have used
{{{#!php
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
}}}
here. I would have used.
{{{#!php
if ( wp_is_json_request() ) {
}}}
CC @whyisjake @SergeyBiryukov
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36271#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list