get_term_by('id') -> get_term(). Add get_term filters to get_term_by.

git-svn-id: https://develop.svn.wordpress.org/trunk@14606 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-05-13 19:16:09 +00:00
parent 6e9e34fb52
commit e35fe8d6d9
1 changed files with 3 additions and 2 deletions

View File

@ -526,8 +526,7 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
$value = stripslashes($value);
$field = 't.name';
} else {
$field = 't.term_id';
$value = (int) $value;
return get_term( (int) $value, $taxonomy, $output, $filter);
}
$term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) );
@ -536,6 +535,8 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
wp_cache_add($term->term_id, $term, $taxonomy);
$term = apply_filters('get_term', $term, $taxonomy);
$term = apply_filters("get_$taxonomy", $term, $taxonomy);
$term = sanitize_term($term, $taxonomy, $filter);
if ( $output == OBJECT ) {