Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Custom Post Type Support for Activity

@anonymized-6594935

Inactive

At What priority does Easy Custom Post Types hooks ‘init’ ?

You need to be sure the post type has been defined before using bp_activity_set_post_type_tracking_args() so change ‘bp_init’ to ‘init’ and try to add a very late priority, eg:

// Don't forget to add the 'buddypress-activity' support!
add_post_type_support( 'sd_article', 'buddypress-activity' );
 
function customize_page_tracking_args() {
    // Check if the Activity component is active before using it.
    if ( ! bp_is_active( 'activity' ) ) {
        return;
    }
 
    bp_activity_set_post_type_tracking_args( 'sd_article', array(
        'component_id'             => 'activity',
        'action_id'                => 'new_sd_article',
        'bp_activity_admin_filter' => __( 'Neuer Artikel veröffentlicht', 'custom-domain' ),
        'bp_activity_front_filter' => __( 'Artikel', 'custom-domain' ),
        'contexts'                 => array( 'activity', 'member' ),
        'bp_activity_new_post'     => __( '%1$s hat den neuen <a href="%2$s">Artikel</a>', 'sozialdynamik' ),
        'bp_activity_new_post_ms'  => __( '%1$s hat den neuen <a href="%2$s">Artikel</a>, on the site %3$s', 'sozialdynamik' ),
        'position'                 => 100,
    ) );
}
add_action( 'init', 'customize_page_tracking_args', 1000 );
Skip to toolbar