From 8849e7b446914363c603f44d59675bbe61991cef Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Thu, 23 Nov 2023 18:00:40 +0100 Subject: [PATCH] Check if the current post type supports ActivityPub. (#570) * Check if the current post type supports ActivityPub. * Update includes/functions.php Co-authored-by: Jeremy Herve * Update functions.php --------- Co-authored-by: Jeremy Herve --- includes/functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index ecb8765..f9d602f 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -279,6 +279,16 @@ function is_activitypub_request() { return false; } + // Check if the current post type supports ActivityPub. + if ( \is_singular() ) { + $queried_object = \get_queried_object(); + $post_type = \get_post_type( $queried_object ); + + if ( ! \post_type_supports( $post_type, 'activitypub' ) ) { + return false; + } + } + // One can trigger an ActivityPub request by adding ?activitypub to the URL. // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration global $wp_query;