Comments to only be seen by their author

The filter that you mention modifies the result of the get_comments function after it has been fetched. However, you can also parse arguments to this function. You can see which arguments here. As you can see you can limit results to comments from a certain author or exclude them.

Now, here is where your question becomes a bit sketchy. It’s not clear whether you want only comments of the current author to show, or all comments except those by authors who are not the current author (meaning: comments by current authors and comments made by people who are not authors).

The first is pretty straightforward. Fetch the current author and limit results accordingly.

$current_user_id = get_the_author_meta('ID');
if (!empty($current_user_id))
  $current_comments = get_comments (array('post_id' => get_the_ID(), 'post_author__in' => array($current_user_id)));

The second is slightly more complicated. You will have to fetch an array of all authors, except the current user from and the get all comments excluding all other registered authors.

$current_user_id = get_the_author_meta('ID');
if (!empty($current_user_id)) {
  $non_current_user_ids = get_users (array ('exclude' => array($current_user_id)));
  $current_comments = get_comments (array('post_id' => get_the_ID(), 'post_author__not_in' => array($current_user_id)));
  }

Note: I did not test the code. It is given here as a proof of concept.

Your question does not cover what happens when a user is not logged in. Does he get to see all comments or only those by non-registered users?

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedusedueduseduseduseduseduedusedus