In `get_terms()`, don't store `WP_Term` objects in cache.

Fixes #34282.
Built from https://develop.svn.wordpress.org/trunk@35117


git-svn-id: http://core.svn.wordpress.org/trunk@35082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-10-13 02:58:24 +00:00
parent fc842e33c9
commit 7de3499949
2 changed files with 8 additions and 3 deletions

View File

@ -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 );
}

View File

@ -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.