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:
parent
52934a6cee
commit
43bb491419
|
@ -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