diff --git a/functions.php b/functions.php index bd0deff..b880e59 100644 --- a/functions.php +++ b/functions.php @@ -79,7 +79,9 @@ public function add_security_headers() { * Add headers to REST API responses */ public function add_rest_api_headers($response) { - $response->header('X-Robots-Tag', 'noindex, nofollow'); + if ($response instanceof WP_REST_Response) { + $response->header('X-Robots-Tag', 'noindex, nofollow'); + } return $response; }