Fix category search pagination. Fix caching of empty term results. Props Denis-de-Bernardy. fixes #8632

git-svn-id: https://develop.svn.wordpress.org/trunk@11140 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2009-04-30 16:51:45 +00:00
parent f0bcbd96bc
commit c50d877687
2 changed files with 11 additions and 7 deletions
+6 -1
View File
@@ -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
));