mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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:
parent
252e24395f
commit
8e9f48b472
@ -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':
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user