The issue is caused by the arguments for separate_comments
being passed by-reference. Source: function separate_comments(&$comments)
. This means passing a function as an argument is restricted.
To resolve the issue you need to assign the get_comments
function results to a variable.
$comments = get_comments('status=approve&post_id=' . $id);
$comments_by_type = separate_comments($comments);
return count($comments_by_type['comment']);