diff --git a/wp-includes/taxonomy-functions.php b/wp-includes/taxonomy-functions.php index 0c89ac1e51..88f944edc2 100644 --- a/wp-includes/taxonomy-functions.php +++ b/wp-includes/taxonomy-functions.php @@ -1155,6 +1155,9 @@ function get_terms( $taxonomies, $args = '' ) { $cache_key = "get_terms:$key:$last_changed"; $cache = wp_cache_get( $cache_key, 'terms' ); if ( false !== $cache ) { + if ( 'all' === $args['fields'] ) { + $cache = array_map( 'get_term', $cache ); + } /** * Filter the given taxonomy's terms cache. @@ -1494,8 +1497,6 @@ function get_terms( $taxonomies, $args = '' ) { foreach ( $terms as $term ) { $_terms[ $term->term_id ] = $term->slug; } - } else { - $_terms = array_map( 'get_term', $terms ); } if ( ! empty( $_terms ) ) { @@ -1508,6 +1509,10 @@ function get_terms( $taxonomies, $args = '' ) { wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); + if ( 'all' === $_fields ) { + $terms = array_map( 'get_term', $terms ); + } + /** This filter is documented in wp-includes/taxonomy */ return apply_filters( 'get_terms', $terms, $taxonomies, $args ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index d8a3d16ad8..691aab1c6f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35116'; +$wp_version = '4.4-alpha-35117'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.