Cache get_terms queries that return nothing.

git-svn-id: http://svn.automattic.com/wordpress/trunk@6307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-11-02 04:31:44 +00:00
parent 52934a6cee
commit 43bb491419
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);
}
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]);