mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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:
parent
6c82674ea0
commit
f45383244d
@ -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() ) {
|
||||
|
||||
|
@ -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');
|
||||
?>
|
||||
|
@ -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':
|
||||
|
Loading…
Reference in New Issue
Block a user