Changeset 6246

Show
Ignore:
Timestamp:
10/13/07 19:04:39 (11 months ago)
Author:
ryan
Message:

If checking for term within taxonomy, just do the taxonomy specific query. Saves one query.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/taxonomy.php

    r6243 r6246  
    643643    } 
    644644 
    645     $term_id = $wpdb->get_var("SELECT term_id FROM $wpdb->terms as t WHERE $where"); 
    646  
    647     if ( empty($taxonomy) || empty($term_id) ) 
    648         return $term_id; 
    649  
    650     $taxonomy = $wpdb->escape( $taxonomy ); 
    651     return $wpdb->get_row("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = '$taxonomy'", ARRAY_A); 
     645    if ( !empty($taxonomy) ) 
     646        return $wpdb->get_row("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = '$taxonomy'", ARRAY_A); 
     647 
     648    return $wpdb->get_var("SELECT term_id FROM $wpdb->terms as t WHERE $where"); 
    652649} 
    653650