drupal 7 block to show if page has taxonomy term I want to have a block to show only if the current page has a certain taxonomy term and was planning on using the block visiablity settings.

where Pages on which this PHP code returns TRUE (experts only). and need php code to find out how to tell check if taxonomy term is on the page and then the block will show up on nodes with that term.
The code posted by Triskelion did not work for me. Here is the code that I used and worked:

&lt;?php
$term_id_to_trigger_show_block = 14; // show this block on nodes with this term id.
$taxonomy_to_search = "field_machinenameofvocab"; // The 'field_' + machine name of the vocabulary to search for the terms
$make_block_visible = FALSE;

// Show this block on nodes with the right term id 
if (arg(0) == 'node' &amp;&amp; arg(1) &amp;&amp; is_numeric(arg(1))) {
  $node_obj = node_load(arg(1));
  $taxonomy = $node_obj-&gt;$taxonomy_to_search;
  foreach ($taxonomy['und'] as $term) {
    if ($term['tid'] == $term_id_to_trigger_show_block) {
      $make_block_visible = TRUE;
    }
  }
}

return $make_block_visible;
?&gt;


Note that $taxonomy_to_search should be set equal to the machine name of the vocabulary prefixed with field_. So if my vocabulary machine name is animal_species that line would be $taxonomy_to_search = "field_animal_species";

UPDATE:
After using the above code on a site for quite some time I realized that it was giving me PHP errors in my logs. My solution was to give up on displaying a standard block and use views instead.

Create a new block view, set it to display fields. For your only field use "Global: Custom Text," entering your desired block content in the custom text field.

Under "Contextual Filters" add "Content: NID" and then "Provide default value" of "Content ID from URL."

Finally under "Filter Criteria" your only filter should be "Content: Has taxonomy term." Set it up to look for your term.