Skip to content

Instantly share code, notes, and snippets.

@dshanske
Created December 22, 2022 20:50
Show Gist options
  • Save dshanske/e2659241f1c8c064441737afbd89654c to your computer and use it in GitHub Desktop.
Save dshanske/e2659241f1c8c064441737afbd89654c to your computer and use it in GitHub Desktop.
ActivityPub Xray Override
add_action( 'init', 'activitypub_xray_override_init', 11 );
function activitypub_xray_override_init() {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$accept_header = $_SERVER['HTTP_ACCEPT'];
if ( stristr( $accept_header, 'application/activity+json' ) && stristr( $user_agent, 'XRay' ) ) {
remove_filter( 'template_include', array( '\Activitypub\Activitypub', 'render_json_template' ), 99 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment