diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index 7bf9fab..baf7d67 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -19,9 +19,9 @@ class Activitypub { add_post_type_support( 'post', 'activitypub' ); add_post_type_support( 'page', 'activitypub' ); - $post_types = get_post_types_by_support( 'activitypub' ); add_action( 'transition_post_status', array( '\Activitypub\Activitypub', 'schedule_post_activity' ), 10, 3 ); } + /** * Return a AS2 JSON version of an author, post or page * @@ -99,6 +99,12 @@ class Activitypub { return; } + // check if post-type supports ActivityPub + $post_types = get_post_types_by_support( 'activitypub' ); + if ( ! in_array( $post->post_type, $post_types, true ) ) { + return; + } + if ( 'publish' === $new_status && 'publish' !== $old_status ) { wp_schedule_single_event( time() + wp_rand( 0, 120 ), 'activitypub_send_post_activity', array( $post->ID ) ); } elseif ( 'publish' === $new_status ) {