From e35fe8d6d94ebeba4dbe88cf846c1865ae64a5a7 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 13 May 2010 19:16:09 +0000 Subject: [PATCH] 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 --- wp-includes/taxonomy.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 660387b632..20db89064b 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -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 ) {