Make posts per page filters consistent and back compat. Props wpmuguru. fixes #14135 for 3.1

git-svn-id: http://svn.automattic.com/wordpress/trunk@15450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-07-21 17:27:04 +00:00
parent 34e43c7bce
commit fd6cc7c779
2 changed files with 7 additions and 5 deletions

View File

@ -43,12 +43,13 @@ if ( 'post' != $post_type ) {
$pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0;
if ( empty($pagenum) )
$pagenum = 1;
$per_page = 'edit_' . $post_type . '_per_page';
$per_page = (int) get_user_option( $per_page );
$edit_per_page = 'edit_' . $post_type . '_per_page';
$per_page = (int) get_user_option( $edit_per_page );
if ( empty( $per_page ) || $per_page < 1 )
$per_page = 20;
// @todo filter based on type
$per_page = apply_filters( 'edit_posts_per_page', $per_page );
$per_page = apply_filters( $edit_per_page, $per_page );
$per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
// Handle bulk actions
if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) || isset($_GET['bulk_edit']) ) {

View File

@ -895,8 +895,9 @@ function wp_edit_posts_query( $q = false ) {
$posts_per_page = (int) get_user_option( $per_page );
if ( empty( $posts_per_page ) || $posts_per_page < 1 )
$posts_per_page = 20;
$posts_per_page = apply_filters( $per_page, $posts_per_page );
$posts_per_page = apply_filters( $per_page, $posts_per_page );
$posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type );
$query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');