Fix per_page screen option for custom post types and taxonomies. Don't convert taxonomy and post type slugs from hyphen to underscore when saving the per_page usermeta. Props nacin. see #18958

git-svn-id: http://core.svn.wordpress.org/trunk@21322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2012-07-25 16:13:13 +00:00
parent 6c82674ea0
commit f45383244d
3 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ if ( 'post' != $post_type ) {
$submenu_file = "edit-tags.php?taxonomy=$taxonomy";
}
add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') );
add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) );
switch ( $wp_list_table->current_action() ) {

View File

@ -215,7 +215,7 @@ if ( 'post' == $post_type ) {
);
}
add_screen_option( 'per_page', array('label' => $title, 'default' => 20) );
add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
require_once('./admin-header.php');
?>

View File

@ -328,15 +328,15 @@ function set_screen_options() {
if ( !preg_match( '/^[a-z_-]+$/', $option ) )
return;
$option = str_replace('-', '_', $option);
$map_option = $option;
$type = str_replace('edit_', '', $map_option);
$type = str_replace('_per_page', '', $type);
if ( in_array($type, get_post_types()) )
$map_option = 'edit_per_page';
if ( in_array( $type, get_taxonomies()) )
if ( in_array( $type, get_taxonomies() ) )
$map_option = 'edit_tags_per_page';
elseif ( in_array( $type, get_post_types() ) )
$map_option = 'edit_per_page';
else
$option = str_replace('-', '_', $option);
switch ( $map_option ) {
case 'edit_per_page':