From a14ee51cad8774d8ffec349789ae409de4c95a23 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 6 Feb 2010 17:51:24 +0000 Subject: [PATCH] Use canonical status list. see #9674 git-svn-id: https://develop.svn.wordpress.org/trunk@12995 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 1a84a104b4..dafbec2268 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'] ) {