Modifying page title with THEME_preprocess_page_title I'm running Drupal 8.2.6, and an Adaptive subtheme and I am trying to modify the page title. I have created the following function in THEME.theme

function THEME_preprocess_page_title(&amp;$variables) {
  $color_title = str_ireplace('some text', 'Some &lt;span class="ct-green"&gt;TEXT&lt;/span&gt;', $variables['title']);
  $variables['title'] = $color_title;
}


unfortunately, it's not working, at all. I've even tried just

$variables['title'] = 'Hello World';


to see if it would work, but no dice.

EDIT
So the hunt goes on!

Apparently AdaptiveTheme doesn't use the page title block, it writes it into node.html.twig via field--node--title.html.twig

so far, I have edited THEME_preprocess_field__node__title(&amp;$variables) with no luck, but THEME_preprocess_node() seems to work. kind of. if i do

$variables['title'] = 'hello world';


it works, but it still won't let me put the span tags in. I have found the reason for that, titles aren't allowed to have code because of XSS threats. 

OK. Fine. Fair enough.

There is options in the code to allow you to to allow certain tags (i found documentation, then i lost it ... argghh)

I will keep this question updated as I go
I think you are looking in wrong place. As far as i remember, in Drupal 8 title is rendered trough block called page_title_block

function MODULE_preprocess_block(&amp;$variables) {
  if ($variables['plugin_id'] == 'page_title_block') {
    $color_title = str_ireplace('some text', 'Some &lt;span class="ct-green"&gt;TEXT&lt;/span&gt;', $variables['content']['#title']);
    $variables['content']['#title'] = $color_title;
  }
}