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 ) {