Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
Created April 15, 2020 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/8c044dc4e9bcc3ab2daf37ad46a42384 to your computer and use it in GitHub Desktop.
Save KaineLabs/8c044dc4e9bcc3ab2daf37ad46a42384 to your computer and use it in GitHub Desktop.
Disale Comments on Custom Activity Types
<?php
/**
* Disale Comments on Custom Activity Types.
*/
function yzc_disable_activity_types_comments( $visibility ) {
$forbidden_types = array( 'activity_status', 'bbp_topic_create', 'bbp_reply_create', 'friendship_accepted','friendship_created', 'new_blog_post' );
if ( in_array( bp_get_activity_type(), $forbidden_types ) ) {
return false;
}
return $visibility;
}
add_filter( 'bp_activity_can_comment', 'yzc_disable_activity_types_comments', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment