Posted on August 8, 2013 , Last Modified on: August 8, 2013

Show Posts from a perticular category only on user profile, other should link to the main site when using BuddyBlog

add_filter( 'buddyblog_show_posts_on_profile', 'buddyblog_custom_permalinks_filter', 10, 2 );
function buddyblog_custom_permalinks_filter( $do_filter, $post ){

    $category = get_category_by_slug( 'blog' );

    $post_categories = get_the_category( $post->ID );

    $post_cat_ids = wp_list_pluck( $post_categories, 'term_id' );
    //if it is in blog category, show on profile
    if( in_array( $category->term_id, $post_cat_ids ) )
            return true;

    return $do_filter;

}

#buddypress #buddyblog @buddyblog