Cache get_terms queries that return nothing.
git-svn-id: https://develop.svn.wordpress.org/trunk@6307 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ae66f7f3c8
commit
77838c2433
@ -640,8 +640,11 @@ function &get_terms($taxonomies, $args = '') {
|
||||
$terms = $wpdb->get_col($query);
|
||||
}
|
||||
|
||||
if ( empty($terms) )
|
||||
return array();
|
||||
if ( empty($terms) ) {
|
||||
$cache[ $key ] = array();
|
||||
wp_cache_set( 'get_terms', $cache, 'terms' );
|
||||
return apply_filters('get_terms', array(), $taxonomies, $args);
|
||||
}
|
||||
|
||||
if ( $child_of || $hierarchical ) {
|
||||
$children = _get_term_hierarchy($taxonomies[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user