Skip to content

Commit

Permalink
Check if the current post type supports ActivityPub. (#570)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
pfefferle and jeherve committed Nov 23, 2023
1 parent ba44ac7 commit 8849e7b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8849e7b

Please sign in to comment.