Skip to content

activitypub_post_object_type

github-actions[bot] edited this page Apr 22, 2026 · 1 revision

Filters the ActivityPub object type for a post.

Allows downstream consumers to override the discriminator that decides whether a post federates as Note, Article, or Page. The filtered value propagates to all internal callers of get_type(), including former_type/tombstone handling, summary and title decisions, the content template, and the preview guard, not only the wire-format type property.

Auto-generated Example

/**
 * Filters the ActivityPub object type for a post.
 * 
 * Allows downstream consumers to override the discriminator that
 * decides whether a post federates as Note, Article, or Page.
 * The filtered value propagates to all internal callers of
 * get_type(), including former_type/tombstone handling,
 * summary and title decisions, the content template, and the
 * preview guard, not only the wire-format type property.
 *
 * @param string  $object_type 
 * @param WP_Post $post 
 * @return string The filtered value.
 */
function my_activitypub_post_object_type_callback( string $object_type, WP_Post $post ) {
    // Your code here.
    return $object_type;
}
add_filter( 'activitypub_post_object_type', 'my_activitypub_post_object_type_callback', 10, 2 );

Parameters

  • string $object_type The computed ActivityPub object type.
  • WP_Post $post The WordPress post being transformed.

Files

\apply_filters( 'activitypub_post_object_type', $object_type, $this->item )

← All Hooks

Users

Developers

Clone this wiki locally