Skip to content

Commit f559f15

Browse files
Merge pull request #2094 from WordPress/use/wp-function-rest-endpoint
Use `wp_is_rest_endpoint()` to detect if we are handling a REST API request
2 parents e6f4f18 + e2c565c commit f559f15

File tree

1 file changed

+1
-2
lines changed
  • plugins/performance-lab/includes/server-timing

1 file changed

+1
-2
lines changed

plugins/performance-lab/includes/server-timing/hooks.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
* @return WP_REST_Response|WP_Error Filtered response.
2323
*/
2424
function perflab_rest_post_dispatch_add_server_timing( $response ) {
25-
// TODO: Change condition to use wp_is_rest_endpoint() once minimum-supported version is WordPress 6.5.
26-
if ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST || ! $response instanceof WP_REST_Response ) {
25+
if ( ! wp_is_rest_endpoint() || ! $response instanceof WP_REST_Response ) {
2726
return $response;
2827
}
2928

0 commit comments

Comments
 (0)