Account for clients not always sending ACCEPT header
This commit is contained in:
parent
4d73cf1e5e
commit
9672c1e1c1
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user