Make WordPress Core

Changeset 6246


Ignore:
Timestamp:
10/13/2007 07:04:39 PM (18 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.