Are you looking for a way to show activity comment count to logged in users only in BuddyPress? While there’s probably a plugin for this, we have created a quick code snippet that you can use to show activity comment count to logged in users only in BuddyPress.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
add_filter( 'bp_activity_get_comment_count' , 'get_bp_comment_count_loggedin', 10,1 ); function get_bp_comment_count_loggedin( $count ){ if ( !is_user_logged_in() ) $count = 0; return $count; }
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: 50+ best WooCommerce themes for your online store and 12 best WordPress podcast plugins.
Comments Leave a Reply