From ba4753fa8d84ce2af25a31a522e7a67a8d7fa156 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 6 Feb 2010 17:51:24 +0000 Subject: [PATCH] Use canonical status list. see #9674 git-svn-id: http://svn.automattic.com/wordpress/trunk@12995 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 1a84a104b..dafbec226 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -2100,20 +2100,10 @@ class WP_Query { // @todo Use register_post_status() data to determine which states should be excluded. $r_status[] = "$wpdb->posts.post_status <> 'trash'"; } else { - if ( in_array( 'draft' , $q_status ) ) - $r_status[] = "$wpdb->posts.post_status = 'draft'"; - if ( in_array( 'pending', $q_status ) ) - $r_status[] = "$wpdb->posts.post_status = 'pending'"; - if ( in_array( 'future' , $q_status ) ) - $r_status[] = "$wpdb->posts.post_status = 'future'"; - if ( in_array( 'inherit' , $q_status ) ) - $r_status[] = "$wpdb->posts.post_status = 'inherit'"; - if ( in_array( 'private', $q_status ) ) - $p_status[] = "$wpdb->posts.post_status = 'private'"; - if ( in_array( 'publish', $q_status ) ) - $r_status[] = "$wpdb->posts.post_status = 'publish'"; - if ( in_array( 'trash', $q_status ) ) - $r_status[] = "$wpdb->posts.post_status = 'trash'"; + foreach ( get_post_stati() as $status ) { + if ( in_array( $status, $q_status ) ) + $r_status[] = "$wpdb->posts.post_status = '$status'"; + } } if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {