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 <jeremy@jeremy.hu>

* Update functions.php

---------

Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
This commit is contained in:
Matthias Pfefferle 2023-11-23 18:00:40 +01:00 committed by GitHub
parent ba44ac701b
commit 8849e7b446
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;