diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 9ef2e050c..6bc72aea4 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -166,12 +166,17 @@ if ( empty($cats_per_page) ) $cats_per_page = 20; $cats_per_page = apply_filters('edit_categories_per_page', $cats_per_page); +if ( !empty($_GET['s']) ) + $num_cats = count(get_categories(array('hide_empty' => 0, 'search' => $_GET['s']))); +else + $num_cats = wp_count_terms('category'); + $page_links = paginate_links( array( 'base' => add_query_arg( 'pagenum', '%#%' ), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), - 'total' => ceil(wp_count_terms('category') / $cats_per_page), + 'total' => ceil($num_cats / $cats_per_page), 'current' => $pagenum )); diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index ef81bdf7e..068dae4ed 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -662,10 +662,10 @@ function &get_terms($taxonomies, $args = '') { wp_cache_set('last_changed', $last_changed, 'terms'); } $cache_key = "get_terms:$key:$last_changed"; - - if ( $cache = wp_cache_get( $cache_key, 'terms' ) ) { - $terms = apply_filters('get_terms', $cache, $taxonomies, $args); - return $terms; + $cache = wp_cache_get( $cache_key, 'terms' ); + if ( false !== $cache ) { + $cache = apply_filters('get_terms', $cache, $taxonomies, $args); + return $cache; } if ( 'count' == $orderby ) @@ -780,8 +780,7 @@ function &get_terms($taxonomies, $args = '') { } if ( empty($terms) ) { - $cache[ $key ] = array(); - wp_cache_set( 'get_terms', $cache, 'terms' ); + wp_cache_add( $cache_key, array(), 'terms' ); $terms = apply_filters('get_terms', array(), $taxonomies, $args); return $terms; }