Allow per_page settings for custom post type edit screens. see #9674

git-svn-id: https://develop.svn.wordpress.org/trunk@12707 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-01-12 15:41:10 +00:00
parent 0e4bc929a1
commit 2a68d3919d
2 changed files with 11 additions and 1 deletions

View File

@ -399,7 +399,13 @@ function set_screen_options() {
$option = str_replace('-', '_', $option);
switch ( $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';
switch ( $map_option ) {
case 'edit_per_page':
case 'edit_pages_per_page':
case 'edit_comments_per_page':

View File

@ -851,6 +851,10 @@ function wp_edit_posts_query( $q = false ) {
$orderby = 'date';
}
if ( 'post' != $post_type )
$per_page = 'edit_' . $post_type . '_per_page';
else
$per_page = 'edit_per_page';
$posts_per_page = (int) get_user_option( 'edit_per_page' );
if ( empty( $posts_per_page ) || $posts_per_page < 1 )
$posts_per_page = 15;