Determines whether WordPress is currently serving a REST API request.
Description
The function relies on the 'REST_REQUEST' global. As such, it only returns true when an actual REST <em>request</em> is being made. It does not return true when a REST endpoint is hit as part of another request, e.g. for preloading a REST response. See wp_is_rest_endpoint() for that purpose. This function should not be called until the 'parse_request' action, as the constant is only defined then, even for an actual REST request.
Return
bool
True if it's a WordPress REST API request, false otherwise.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.