Notice: Undefined index: node-readmore in theme_preprocess_node() I am using this code on D7 for my themes template.php to replace default 'Read More' title with 'Read More →' (it just adds arrow):

function theme_preprocess_node(&amp;$vars){
  $vars['content']['links']['node']['#links']['node-readmore']['title'] = str_replace("Read more","Read more →",$vars['content']['links']['node']['#links']['node-readmore']['title']);
}


It all works, but when clearing cache I get this error message:

Notice: Undefined index: node-readmore in theme_preprocess_node()
Probably the page view of the node not including the read more link.

e.g

function theme_preprocess_node(&amp;$vars){
  if(!$vars['page']){
    $vars['content']['links']['node']['#links']['node-readmore']['title'] = t('Read more →'); 
  }
}


or perhaps

function theme_preprocess_node(&amp;$vars){
  if(isset($vars['content']['links']['node']['#links']['node-readmore'])){
    $vars['content']['links']['node']['#links']['node-readmore']['title'] = t('Read more →'); 
  }
}


No need for the str_replace either if just setting the full text string.

Note, an alternative is to translate that text,

e.g with stringoverrides or in settings.php 

$conf['locale_custom_strings_en'][''] = array(
  'Read more'      =&gt; 'Read more  →',
  'Old text 2'      =&gt; 'New text 2',
);