How to modify taxonomy term path in the page render array? I'm trying to change the path of a term before it's displayed on a node page. I'm using this preprocess function in template.php:

function bartik_preprocess_node(&amp;$variables) {
    $variables['field_photo_topic']['0']['taxonomy_term']-&gt;uri['path'] = 'photo/test';
}


The path won't change, what am I missing? This is the dpm output:
This question makes perfect sense if photo/% and video/% are views.  It might be even better to map taxonomy/term/% to topic/%, and then make a single view with a path topic/%/%, where one argument is the content type and the other is the taxonomy term. However, you may also use the paths you suggest by building two views (or two pages in one view), each with its own path.

On to your main question, though. Changing items in the render array is easy, but it can sometimes be hard to figure out what needs to change and when. It is a general problem with render arrays that sometimes there are shadow copies of info that are available for your reference. Changing these copies does not affect the rendering of the page, because they are only copies of the item that is used to build the actual page.  The problem with the code in your question is that it was altering a copy of the target link; the master information that you need to change to affect page rendering appears somewhere else in the data structure.  You need to adjust the copy that appears inside the 'content' item.

Here is some code that works for a similar content type:

function MYTHEME_preprocess_node(&amp;$vars) {
  if (array_key_exists('content', $vars)) {
    $content = &amp;$vars['content'];
      if (array_key_exists('field_photo_topic', $content)) {
        foreach ($content['field_photo_topic']['#items'] as $index =&gt; $info) {
          $tid = $info['tid'];
          $content['field_photo_topic'][$index]['#href'] = 'photos/' . $tid;
        }
      }
  }
}


From here, you can use pathauto to map photos/% to a pleasing URL to your photos + taxonomy term view.