Drupal 8 rewrite a hook I want to rewrite a hook comment_node_links_alter. How can I do it? I created a file THEME.theme in my theme, placed there THEME_comment_node_links_alter but it is not called. I cannot find any distinct information how to rewrite hooks. I observed bartik.theme and saw that all hooks are prepended with a theme name. I did the same. Did clear the cache. My funciton is included, I checked with xdebug. But it is never called.
I think you're getting confused about how Drupal hooks work. You don't overwrite the existing function you instead create your own function that is called when the relevant part of the site is loaded. (So in this case node links)

So there is no THEME_comment_node_links_alter hook. There is HOOK_node_links_alter. So I'm guessing you looked in the comment module and saw comment_node_links_alter which is actually the comment module implementing HOOK_node_links_alter

In your theme/module you'd want to replicate what the comment module is doing so something like 

THEME_node_links_alter(


With THEME being your theme machine name. THen that will mean your function is called and you can amend the variables 

https://api.drupal.org/api/drupal/core%21modules%21node%21node.api.php/function/hook_node_links_alter/8.4.x