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:
Ryan Boren 2007-11-02 04:31:44 +00:00
parent ae66f7f3c8
commit 77838c2433
1 changed files with 5 additions and 2 deletions

View File

@ -640,8 +640,11 @@ function &get_terms($taxonomies, $args = '') {
$terms = $wpdb->get_col($query); $terms = $wpdb->get_col($query);
} }
if ( empty($terms) ) if ( empty($terms) ) {
return array(); $cache[ $key ] = array();
wp_cache_set( 'get_terms', $cache, 'terms' );
return apply_filters('get_terms', array(), $taxonomies, $args);
}
if ( $child_of || $hierarchical ) { if ( $child_of || $hierarchical ) {
$children = _get_term_hierarchy($taxonomies[0]); $children = _get_term_hierarchy($taxonomies[0]);