X

How to Add BuddyPress Page and Post Comments in Activity Stream

Snippets by IsItWP

Are you looking for a way to display comments from your posts and pages in the activity stream? While there’s probably a plugin for this, we have created a quick code snippet that you can use to add BuddyPress page and post comments in activity stream to display new comments.

Instructions:

All you have to do is add this code to your theme’s bp-custom.php file:

function push_comments_to_activity() {
     return array( 'page', 'post' );
}
add_filter( 'bp_blogs_record_comment_post_types', 'push_comments_to_activity' );

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 12 best WordPress plugins for bloggers and how to create a guest post submission form in WordPress.

Comments   Leave a Reply

  1. how will i make the activity post feed fit with the page whenever a user post image or video am using buddyboss platform with buddyboss theme

  2. I have a buddypress with a theme(youzify), I want to display activitys posts randomly on home page, I want posts to be displayed randomly, not in chronological order
    anyone knows any code or method for that

  3. Hi,

    Thanks for this helpful little snippet. I am using DCO attachment plugin which allows users to attach images in the comments. With your snippet, I can see the post comment in the activity stream but not the image attached to it. Is it possible to import that images as well?

    Would really appreciate any guidance regarding this.

    Kind regards
    Aniket.

  4. A tip is to use the Code Snippets plugin to add such PHP codes for testing.

  5. Where is the theme’s bp-custom.php?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!