From f45383244d348d42a89f72b32d71f6848bdc0ed9 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 25 Jul 2012 16:13:13 +0000 Subject: [PATCH] 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 --- wp-admin/edit-tags.php | 2 +- wp-admin/edit.php | 2 +- wp-admin/includes/misc.php | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 29bcad4289..966cb3742b 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -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() ) { diff --git a/wp-admin/edit.php b/wp-admin/edit.php index ab16be088f..671311c4b1 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -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'); ?> diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 14f94fbed7..24cfd2cb8b 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -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':