Disable Blog Posts and new Blog Comments recording/tracking In the activity by BuddyPress
Thanks to @Frank for asking the question. If you are using BuddyPress with WordPress single user(Not wordpress multisite), there are no question to disable new Blog post recording/ new Blog Comments recording. In case of Multisite, you can disable it from from Component setup->Blog Tracking.
So, Here are the two ways, you can use to disable new blog posts recoring to activity an new blog comments recording to activity.
Approach 1:- Disable the blog component:-
By Putting the following line in bp-custom.php you can disable the blogs component completely and It will not record new posts/comments
1 2 3 4 5 6 7 8 9 | function disable_blog_component( $disabled_components ) { $disabled_components['bp-blogs.php'] = 1; return $disabled_components; } add_filter( 'bp_deactivated_components', 'disable_blog_component' ); |
Please note, the above code should be put in the bp-custom.php. The above code will disable the blog component for BuddyPress on Single User WordPress(On mutisite install you can make the same happen by going to Dashboard->BuddyPress->Component setup).
Second Approach:-
Now, The second approach applies to both single user as well as Multisite WordPress Install. You can disable specific things, like disable comments recording or disable new blog post or disable the new blog creation recording to activity.
Here is the code
1 2 3 4 5 6 7 8 9 10 11 12 | // disable new blog post recording to activity. remove_action( 'save_post', 'bp_blogs_record_post', 10, 2 ); // disable new blog comment recording. remove_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 ); /*If you have disabled comment recording, please make sure to disable this too*/ // use it only if you have disabled comment recording. remove_action( 'wp_set_comment_status', 'bp_blogs_manage_comment', 10, 2 ); // remove new blog creation recoring from activity, only applies to multisite wordpress install. remove_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 ); |
Please note the above code should be in your theme's functions.php and not in the bp-custom.php.
Hope it helps a few of you 🙂