Why the template_preprocess_field hook is not called for a custom template? I'm working in a site that has implemented the template_preprocess_field() hook. I want to change the content of a field but the code works for all the nodes except for the nodes of a content type that have a custom template (node--emploi.tpl.php) It's strange because I have another template for the nodes of the content type named tarif (node--tarif.tpl.php) and in this case the hook is called. 

Here the piece of code inside the template node--emploi.tpl.php file:

&lt;div class="editor"&gt;
  &lt;?php
  /* At this point the body's h2 do not know what the nid is, so a quick and dirty replace will set it right. */
  print preg_replace('/NO-NID[a-z0-9]*--/', $nid . '--', check_markup($field_stm_emploi_temoignage_body[0]['value'], $field_stm_emploi_temoignage_body[0]['format']));
 ?&gt;
&lt;/div&gt;
As @Clive says the problem was that the code didn't use the render() function for the field output, and in this case the template_preprocess_field() hook is not called.

For the moment I have 2 solutions:


Use the render() function in the template file (node--emploi.tpl.php) to create the output of the field. In this case the template_preprocess_field() hook is called.
Use the template_preprocess_node() hook and check $vars['type'] for my content type. In this case the template file remains equal.