/**
* Filter the returned comment count for a post.
*
* @param string|int $count A string representing the number of comments a post has, otherwise 0.
* @param int $post_id Post ID.
*/
function comment_count( int $count, int $post_id ): int {
if ( ! is_admin() ) {
$comments = get_comments( 'status=approve&post_id=' . $post_id );
$separate_comments = separate_comments( $comments );
return count( $separate_comments['comment'] );
} else {
return $count;
}
}
add_filter( 'get_comments_number', 'comment_count', 0 );
flex: 1 0 min-content; даже при отсутствии white-space: nowrap; никаких переносов не было.
This method does not accept any arguments.