You need to use do_shortcode() for the shortcode to actually work inside PHP
function add_post_content($content) {
if(!is_feed() && !is_home()) {
$above="<p></p>";
$content_of_first_tab = 'A list of related posts ';
$args= array(
'number' => '5',
'post_id' => get_the_ID(), // use post_id, not post_ID.
);
$comments = get_comments( $args );
$output="";
foreach ( $comments as $comment ) :
$output .= $comment->comment_author . '<br />' . $comment->comment_content. '<br />';
endforeach;
$content_of_second_tab = $output ;
$below = do_shortcode( '[tabby title="First Tab"]' . $content_of_first_tab . '[tabby title="Second Tab"]'. $content_of_second_tab. '[tabbyending]' );
$content = $above.''.$content .''.$below;
}
return $content;
}
add_filter('the_content', 'add_post_content');
This question is specific to a plugin and should be posted in the appropriate support forum
Do not copy and paste code unless you know what you’re doing.
I hope that helps you.