Disabling reply link for comments not working
You can use hook_comment_links_alter() rather than THEME_preprocess_comment() .Where as hook_comment_links_alter() will render all the comments links before build:

function YOURMODULE_comment_links_alter(array &amp;$links, Drupal\comment\CommentInterface $entity, array &amp;$context) {
  if (\Drupal::currentUser()-&gt;isAnonymous()) {
    unset($links['comment']['#links']['comment-reply']);
  }
}