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

git-svn-id: http://svn.automattic.com/wordpress/trunk@12707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-01-12 15:41:10 +00:00
parent 252e24395f
commit 8e9f48b472
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;