Make wp_edit_posts_query() more post_type aware. Use array calling style. see #9674

git-svn-id: http://svn.automattic.com/wordpress/trunk@12706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-01-12 15:23:10 +00:00
parent bfb5ac0d25
commit 252e24395f
2 changed files with 10 additions and 10 deletions

View File

@ -24,6 +24,7 @@ if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types(
$post_type = $_GET['post_type'];
else
$post_type = 'post';
$_GET['post_type'] = $post_type;
$post_type_object = get_post_type_object($post_type);

View File

@ -828,12 +828,16 @@ function wp_edit_posts_query( $q = false ) {
$post_stati = apply_filters('post_stati', $post_stati);
$avail_post_stati = get_available_post_statuses('post');
if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types( array('_show' => true) ) ) )
$post_type = $q['post_type'];
else
$post_type = 'post';
$avail_post_stati = get_available_post_statuses($post_type);
$post_status_q = '';
if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) {
$post_status_q = '&post_status=' . $q['post_status'];
$post_status_q .= '&perm=readable';
$post_status = $q['post_status'];
$perm = 'readable';
}
if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
@ -847,17 +851,12 @@ function wp_edit_posts_query( $q = false ) {
$orderby = 'date';
}
$post_type_q = 'post_type=post';
if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types( array('_show' => true) ) ) )
$post_type_q = 'post_type=' . $q['post_type'];
$posts_per_page = (int) get_user_option( 'edit_per_page' );
if ( empty( $posts_per_page ) || $posts_per_page < 1 )
$posts_per_page = 15;
$posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page );
wp("$post_type_q&$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby");
wp( compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page') );
return array($post_stati, $avail_post_stati);
}