Update individual term caches in `get_terms()`.

Merges [30954] to the 4.1 branch.

props boonebgorges.
fixes #30749. see #21760.

Built from https://develop.svn.wordpress.org/branches/4.1@30959


git-svn-id: http://core.svn.wordpress.org/branches/4.1@30947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-12-17 17:36:43 +00:00
parent a0d667ac2f
commit ed60d52e69
1 changed files with 3 additions and 0 deletions

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