[wp-trac] [WordPress Trac] #42061: Add new utility function for checking if the current request is a REST API request.

WordPress Trac noreply at wordpress.org
Fri Apr 13 12:24:35 UTC 2018


#42061: Add new utility function for checking if the current request is a REST API
request.
----------------------------+-----------------------
 Reporter:  lots.0.logs     |       Owner:  (none)
     Type:  enhancement     |      Status:  reopened
 Priority:  normal          |   Milestone:
Component:  Bootstrap/Load  |     Version:  4.9
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  rest-api
----------------------------+-----------------------
Changes (by flixos90):

 * status:  closed => reopened
 * resolution:  wontfix =>


Comment:

 I think this needs to be revisited, for the same purpose we have functions
 like `wp_doing_ajax()` etc. Every function in WordPress can be misused,
 but a `wp_doing_rest()` or `wp_is_rest_request()` would allow fixing weird
 hacks necessary when working with unit tests. See #43751 for an example.

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


More information about the wp-trac mailing list