Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 29856)
+++ wp-includes/taxonomy.php	(working copy)
@@ -1326,31 +1326,6 @@
 		}
 	}
 
-	// $args can be whatever, only use the args defined in defaults to compute the key
-	$filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
-	$key = md5( serialize( wp_array_slice_assoc( $args, array_keys( $defaults ) ) ) . serialize( $taxonomies ) . $filter_key );
-	$last_changed = wp_cache_get( 'last_changed', 'terms' );
-	if ( ! $last_changed ) {
-		$last_changed = microtime();
-		wp_cache_set( 'last_changed', $last_changed, 'terms' );
-	}
-	$cache_key = "get_terms:$key:$last_changed";
-	$cache = wp_cache_get( $cache_key, 'terms' );
-	if ( false !== $cache ) {
-
-		/**
-		 * Filter the given taxonomy's terms cache.
-		 *
-		 * @since 2.3.0
-		 *
-		 * @param array        $cache      Cached array of terms for the given taxonomy.
-		 * @param string|array $taxonomies A taxonomy or array of taxonomies.
-		 * @param array        $args       An array of arguments to get terms.
-		 */
-		$cache = apply_filters( 'get_terms', $cache, $taxonomies, $args );
-		return $cache;
-	}
-
 	$_orderby = strtolower( $args['orderby'] );
 	if ( 'count' == $_orderby ) {
 		$orderby = 'tt.count';
@@ -1494,48 +1469,9 @@
 		$where .= $wpdb->prepare( ' AND ((t.name LIKE %s) OR (t.slug LIKE %s))', $like, $like );
 	}
 
-	$selects = array();
-	switch ( $args['fields'] ) {
-		case 'all':
-			$selects = array( 't.*', 'tt.*' );
-			break;
-		case 'ids':
-		case 'id=>parent':
-			$selects = array( 't.term_id', 'tt.parent', 'tt.count' );
-			break;
-		case 'names':
-			$selects = array( 't.term_id', 'tt.parent', 'tt.count', 't.name' );
-			break;
-		case 'count':
-			$orderby = '';
-			$order = '';
-			$selects = array( 'COUNT(*)' );
-			break;
-		case 'id=>name':
-			$selects = array( 't.term_id', 't.name' );
-			break;
-		case 'id=>slug':
-			$selects = array( 't.term_id', 't.slug' );
-			break;
-	}
-
-	$_fields = $args['fields'];
-
-	/**
-	 * Filter the fields to select in the terms query.
-	 *
-	 * @since 2.8.0
-	 *
-	 * @param array        $selects    An array of fields to select for the terms query.
-	 * @param array        $args       An array of term query arguments.
-	 * @param string|array $taxonomies A taxonomy or array of taxonomies.
-	 */
-	$fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) );
-
 	$join = "INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id";
+	$pieces = array( 'join', 'where', 'orderby', 'order', 'limits' );
 
-	$pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' );
-
 	/**
 	 * Filter the terms query SQL clauses.
 	 *
@@ -1546,31 +1482,52 @@
 	 * @param array        $args       An array of terms query arguments.
 	 */
 	$clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
-	$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
 	$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
 	$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
 	$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
 	$order = isset( $clauses[ 'order' ] ) ? $clauses[ 'order' ] : '';
 	$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
 
-	$query = "SELECT $fields FROM $wpdb->terms AS t $join WHERE $where $orderby $order $limits";
+	$query = "SELECT * FROM $wpdb->terms AS t $join WHERE $where $orderby $order $limits";
 
-	if ( 'count' == $_fields ) {
-		$term_count = $wpdb->get_var($query);
-		return $term_count;
+	// Attempt to use cached query
+	$filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
+	$key = md5( $query . $filter_key );
+	$last_changed = wp_cache_get( 'last_changed', 'terms' );
+	if ( ! $last_changed ) {
+		$last_changed = microtime();
+		wp_cache_set( 'last_changed', $last_changed, 'terms' );
 	}
-
-	$terms = $wpdb->get_results($query);
-	if ( 'all' == $_fields ) {
+	$cache_key = "get_terms:$key:$last_changed";
+	$cache = wp_cache_get( $cache_key, 'terms' );
+	if ( false !== $cache ) {
+		$terms = $cache;
+	} else {
+		$terms = $wpdb->get_results( $query );
+		wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS);
+	}
+	
+	if ( 'count' == $args['fields'] ) {
+		/**
+		 * Filter the given taxonomy's terms cache.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param array        $cache      Cached array of terms for the given taxonomy.
+		 * @param string|array $taxonomies A taxonomy or array of taxonomies.
+		 * @param array        $args       An array of arguments to get terms.
+		 */
+		$terms = apply_filters( 'get_terms', $terms, $taxonomies, $args );
+		return count($terms);
+	}
+	
+	if ( 'all' == $args['fields'] ) {
 		update_term_cache($terms);
 	}
 
 	if ( empty($terms) ) {
-		wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS );
-
 		/** This filter is documented in wp-includes/taxonomy.php */
-		$terms = apply_filters( 'get_terms', array(), $taxonomies, $args );
-		return $terms;
+		return apply_filters( 'get_terms', array(), $taxonomies, $args );
 	}
 
 	if ( $child_of ) {
@@ -1581,7 +1538,7 @@
 	}
 
 	// Update term counts to include children.
-	if ( $args['pad_counts'] && 'all' == $_fields ) {
+	if ( $args['pad_counts'] && 'all' == $args['fields'] ) {
 		_pad_term_counts( $terms, reset( $taxonomies ) );
 	}
 	// Make sure we show empty categories that have children.
@@ -1606,23 +1563,23 @@
 	reset( $terms );
 
 	$_terms = array();
-	if ( 'id=>parent' == $_fields ) {
+	if ( 'id=>parent' == $args['fields'] ) {
 		while ( $term = array_shift( $terms ) ) {
 			$_terms[$term->term_id] = $term->parent;
 		}
-	} elseif ( 'ids' == $_fields ) {
+	} elseif ( 'ids' == $args['fields'] ) {
 		while ( $term = array_shift( $terms ) ) {
 			$_terms[] = $term->term_id;
 		}
-	} elseif ( 'names' == $_fields ) {
+	} elseif ( 'names' == $args['fields'] ) {
 		while ( $term = array_shift( $terms ) ) {
 			$_terms[] = $term->name;
 		}
-	} elseif ( 'id=>name' == $_fields ) {
+	} elseif ( 'id=>name' == $args['fields'] ) {
 		while ( $term = array_shift( $terms ) ) {
 			$_terms[$term->term_id] = $term->name;
 		}
-	} elseif ( 'id=>slug' == $_fields ) {
+	} elseif ( 'id=>slug' == $args['fields'] ) {
 		while ( $term = array_shift( $terms ) ) {
 			$_terms[$term->term_id] = $term->slug;
 		}
@@ -1636,11 +1593,8 @@
 		$terms = array_slice( $terms, $offset, $number );
 	}
 
-	wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );
-
 	/** This filter is documented in wp-includes/taxonomy */
-	$terms = apply_filters( 'get_terms', $terms, $taxonomies, $args );
-	return $terms;
+	return apply_filters( 'get_terms', $terms, $taxonomies, $args );
 }
 
 /**
