mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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:
@@ -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
|
||||
));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user