If checking for term within taxonomy, just do the taxonomy specific query. Saves one query.
git-svn-id: https://develop.svn.wordpress.org/trunk@6246 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cf584c357f
commit
2fe73132c6
|
@ -642,13 +642,10 @@ function is_term($term, $taxonomy = '') {
|
||||||
$where = $wpdb->prepare( "t.slug = %s", $term );
|
$where = $wpdb->prepare( "t.slug = %s", $term );
|
||||||
}
|
}
|
||||||
|
|
||||||
$term_id = $wpdb->get_var("SELECT term_id FROM $wpdb->terms as t WHERE $where");
|
if ( !empty($taxonomy) )
|
||||||
|
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);
|
||||||
|
|
||||||
if ( empty($taxonomy) || empty($term_id) )
|
return $wpdb->get_var("SELECT term_id FROM $wpdb->terms as t WHERE $where");
|
||||||
return $term_id;
|
|
||||||
|
|
||||||
$taxonomy = $wpdb->escape( $taxonomy );
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue