Fix Terms Per Page for taxonomies, Apply old Category filter to value. See #11838
git-svn-id: http://svn.automattic.com/wordpress/trunk@13081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
833f6172f7
commit
ea6e709e1d
|
@ -196,11 +196,24 @@ $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
|
|||
if ( empty($pagenum) )
|
||||
$pagenum = 1;
|
||||
|
||||
$tags_per_page = (int) get_user_option( 'edit_tags_per_page' );
|
||||
if ( 'post_tag' == $taxonomy )
|
||||
$tags_per_page = (int) get_user_option( 'edit_tags_per_page' );
|
||||
elseif ( 'category' == $taxonomy )
|
||||
$tags_per_page = (int) get_user_option( 'categories_per_page' );
|
||||
else
|
||||
$tags_per_page = (int) get_user_option( 'edit_' . $taxonomy . '_per_page' );
|
||||
|
||||
if ( empty($tags_per_page) || $tags_per_page < 1 )
|
||||
$tags_per_page = 20;
|
||||
$tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
|
||||
$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
|
||||
|
||||
if ( 'post_tag' == $taxonomy ) {
|
||||
$tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
|
||||
$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
|
||||
} elseif ( 'category' == $taxonomy ) {
|
||||
$tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter
|
||||
} else {
|
||||
$tags_per_page = apply_filters( 'edit_' . $taxonomy . '_per_page', $tags_per_page );
|
||||
}
|
||||
|
||||
if ( !empty($_GET['s']) ) {
|
||||
$searchterms = trim(stripslashes($_GET['s']));
|
||||
|
|
|
@ -3638,11 +3638,14 @@ function screen_options($screen) {
|
|||
case 'upload':
|
||||
$per_page_label = __('Media items per page:');
|
||||
break;
|
||||
case 'categories':
|
||||
$per_page_label = __('Categories per page:');
|
||||
break;
|
||||
case 'edit-tags':
|
||||
$per_page_label = __('Tags per page:');
|
||||
global $taxonomy, $tax;
|
||||
if ( 'post_tag' == $taxonomy )
|
||||
$per_page_label = __('Tags per page:');
|
||||
elseif ( 'category' == $taxonomy )
|
||||
$per_page_label = __('Categories per page:');
|
||||
else
|
||||
$per_page_label = sprintf(_x('%s per page:', '%s: plural taxonomy name'), $tax->label);
|
||||
break;
|
||||
case 'plugins':
|
||||
$per_page_label = __('Plugins per page:');
|
||||
|
@ -3652,6 +3655,13 @@ function screen_options($screen) {
|
|||
}
|
||||
|
||||
$option = str_replace( '-', '_', "{$screen->id}_per_page" );
|
||||
if ( 'edit_tags_per_page' == $option ) {
|
||||
if ( 'category' == $taxonomy )
|
||||
$option = 'categories_per_page';
|
||||
elseif ( 'post_tag' != $taxonomy )
|
||||
$option = 'edit_' . $taxonomy . '_per_page';
|
||||
}
|
||||
|
||||
$per_page = (int) get_user_option( $option );
|
||||
if ( empty( $per_page ) || $per_page < 1 ) {
|
||||
if ( 'plugins' == $screen->id )
|
||||
|
@ -3659,9 +3669,10 @@ function screen_options($screen) {
|
|||
else
|
||||
$per_page = 20;
|
||||
}
|
||||
|
||||
if ( 'edit_comments_per_page' == $option )
|
||||
$per_page = apply_filters( 'comments_per_page', $per_page, isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all' );
|
||||
elseif ( 'categories' == $option )
|
||||
elseif ( 'categories_per_page' == $option )
|
||||
$per_page = apply_filters( 'edit_categories_per_page', $per_page );
|
||||
else
|
||||
$per_page = apply_filters( $option, $per_page );
|
||||
|
|
Loading…
Reference in New Issue