From 9672c1e1c111d5cffd72e44b25086eb4a292294f Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sun, 11 Nov 2018 09:02:51 -0500 Subject: [PATCH] Account for clients not always sending ACCEPT header --- includes/server/api.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/server/api.php b/includes/server/api.php index 379c32f..792a6b6 100644 --- a/includes/server/api.php +++ b/includes/server/api.php @@ -135,7 +135,10 @@ function query_vars( $query_vars ) { function handle_non_api_requests() { global $wp; global $wp_query; - $accept = $_SERVER['HTTP_ACCEPT']; + $accept = ''; + if ( array_key_exists( 'HTTP_ACCEPT', $_SERVER ) ) { + $accept = $_SERVER['HTTP_ACCEPT']; + } if ( strpos( $accept, 'application/ld+json' ) !== false ) { $current_url = home_url( add_query_arg( $_GET, \trailingslashit( $wp->request ) ) ); $object = \pterotype\objects\get_object_by_url( $current_url );