[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 Nov 10 20:40:04 UTC 2023
#42061: Add new utility function for checking if the current request is a REST API
request.
------------------------------------+------------------------------------
Reporter: lots.0.logs | Owner: TimothyBlynJacobs
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.5
Component: Bootstrap/Load | Version: 4.9
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses: rest-api, performance
------------------------------------+------------------------------------
Changes (by flixos90):
* milestone: Future Release => 6.5
Comment:
@TimothyBlynJacobs I've taken another stab at this via
https://github.com/WordPress/wordpress-develop/pull/5658. Please refer to
the PR description for more context on what approach I am proposing.
TL;DR: Most core use that checks `REST_REQUEST` is not actually about
whether a "standalone" REST API request is made than it is about whether a
REST endpoint request is currently being handled (e.g. could also be a
preload request made within a regular WordPress request).
Let me know your thoughts on the PR. If it's valuable, we could also
consider splitting this apart into another ticket if you feel like it
doesn't address the original request here as much.
I'm putting this into 6.5 for consideration.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42061#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list