感谢shanebp的回答。我将我的完整功能作为答案发布,这样它也可以帮助其他人(不确定是否要将其添加到问题本身)
function jw_record_my_custom_comments_strings($activity_action, $comment_id, $is_approved = true ) {
global $bp;
$recorded_comment = get_comment( $comment_id );
// Get blog and post data
$blog_id = get_current_blog_id();
$recorded_comment->post = get_post( $recorded_comment->comment_post_ID );
if ( in_array( $recorded_comment->post->post_type, apply_filters( \'bp_blogs_record_comment_post_types\', array( \'business\' ) ) ) )
$activity_action = sprintf( __( \'%1$s wrote a review on, %2$s\', \'buddypress\' ), bp_core_get_userlink( $user_id ), \'<a href="\' . $post_permalink . \'">\' . apply_filters( \'the_title\', $recorded_comment->post->post_title ) . \'</a>\' );
return $activity_action;
}