基于以下代码another question that you referenced, 我通过使用jQuery:
add_filter( \'the_comments\', \'wpse_236055_filter_comments\' );
add_action( \'admin_head\', \'wpse_236055_comment_notification\' );
function wpse_236055_filter_comments( $comments ){ // Display comments related to the author
    global $pagenow, $user_ID, $comment_count;
    wp_get_current_user();
    if ( $pagenow == \'edit-comments.php\' && current_user_can( \'author\' ) ) {
        foreach( $comments as $i => $comment ) {
            $the_post = get_post( $comment -> comment_post_ID );
            if ( $comment -> user_id != $user_ID  && $the_post -> post_author != $user_ID ) {
                unset( $comments[$i] );
            }
        }
    }
    $comment_count = count( $comments );
    // echo \'<!-- DEBUG PRINT --> <pre>\'; print_r( $comment_count ); echo \'</pre>\';
    return $comments;
}
function wpse_236055_comment_notification( $comments ) { // Only show total count of comment related to the author
    global $pagenow, $comment_count;
    $site_name = \'Comments (\' . count( $comments ) . \') ‹ \' . get_bloginfo( \'name\' ) .  \' — WordPress\';
    if ( !current_user_can( \'administrator\' ) ) {
        ?>
        <script type="text/javascript">
            jQuery( document ).ready( function( $ ) {
                $( \'.pending-count\' ).html( \'<?php echo $comment_count; ?>\' );
                $( \'.comment-count-pending\' ).html( \'<?php echo $comment_count; ?>\' );
            } );
        </script>
        <?php
        }
    if ( $pagenow == \'edit-comments.php\' && !current_user_can( \'administrator\' ) ) {
        ?>
        <script type="text/javascript">
            jQuery( document ).ready( function( $ ) {
                $( document.title = \'<?php echo $site_name; ?>\' );
            } );
        </script>
        <?php
    }
}
 因此,“评论”菜单项将只显示与作者相关的评论数量,而不是评论总数。这已经在我这方面进行了测试,并且有效。