Make taxonomy term only link to term page if multiple nodes have that term? I have a free tagging taxonomy term field. How can I make it so on the node page the term only links to a term page if there are multiple nodes with the same term? 

Otherwise this link and page are pointless, and are bad UX as the user will be expecting to see other similar nodes. So if there is only 1 node with a term then I would like the term to not be a link. 

UPDATE ive tried creating a custom module called taxonomy_link_my.

In my taxonomy_link_my.info

name = Taxonomy link my 
description = Stop taxonomy term being a link if no other nodes are tagged with the term.
core = 7.x


In my taxonomy_link_my.module (topic is the vocabulary name). 

&lt;?php

/**
 * Implements hook_node_view
 */
function taxonomy_link_my_node_view($node, $view_mode, $langcode) {
  if (isset($node-&gt;content['topic'])) {
    foreach ($node-&gt;content['topic']['#items'] as $delta =&gt; $item) {
       if (count(taxonomy_select_nodes($item['taxonomy_term']-&gt;tid)) &lt; 2) {
         $title = $node-&gt;content['topic'][$delta]['#title'];
         $node-&gt;content['topic'][$delta] = array();
         $node-&gt;content['topic'][$delta]['#markup'] = $title;
       }
    }
  }
}


However it seems to have no effect.
Looks possible implementing  hook_entity_info_alter()


  Modules may implement this hook to alter the information that defines
  an entity. All properties that are available in hook_entity_info() can
  be altered here.


Here is some sample code

function mymodule_entity_info_alter(&amp;$entity_info) {
  $entity_info['taxonomy_term']['uri callback'] = 'mymodule_taxonomy_term_uri';
}

/**
* Entity uri callback for taxonomy terms. Add special exception to redirect users away
* from taxonomy term pages to the associated program node page.
*/
function mymodule_taxonomy_term_uri($term) {
  if (count(taxonomy_select_nodes($term-&gt;tid)) &gt; 1) {
    return array(
      'path' =&gt; 'taxonomy/term/' . $term-&gt;tid,
    );
  }
  else {
    return array(
      'path' =&gt; '',
    );
  }
}


You need to make some tweaks to get term id by term name.I have not checked about returning the path if node count is 1.