Update individual term caches in get_terms().

This was removed in [29915] as part of the attempt to add cache support to
`get_term_by()`. When that support was removed in [30900], it was not properly
restored.

This changeset includes a unit test to verify that the cache is properly primed
for terms found in `get_terms()`, as well as tests to verify the other cache
setting that was touched by [30900].

Fixes #30749. See #21760.
Built from https://develop.svn.wordpress.org/trunk@30954


git-svn-id: http://core.svn.wordpress.org/trunk@30942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2014-12-17 16:39:24 +00:00
parent e5b753a48a
commit e1ebba28d4

View File

@ -1912,6 +1912,9 @@ function get_terms( $taxonomies, $args = '' ) {
}
$terms = $wpdb->get_results($query);
if ( 'all' == $_fields ) {
update_term_cache( $terms );
}
if ( empty($terms) ) {
wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS );