]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/query.php
Wordpress 3.1.4
[autoinstalls/wordpress.git] / wp-includes / query.php
index ed08ebc450ec8be5bbebd8aa36aefad0487f8bfa..6c0bd38d60eeb05a62c834d9bda4828e1c4eeb67 100644 (file)
@@ -1625,8 +1625,12 @@ class WP_Query {
                                $qv['post_type'] = sanitize_key($qv['post_type']);
                }
 
-               if ( !empty($qv['post_status']) )
-                       $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
+               if ( ! empty( $qv['post_status'] ) ) {
+                       if ( is_array( $qv['post_status'] ) )
+                               $qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
+                       else
+                               $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
+               }
 
                if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
                        $this->is_comment_feed = false;
@@ -2231,10 +2235,6 @@ class WP_Query {
                        }
                }
 
-               if ( !empty( $this->tax_query->queries ) || !empty( $q['meta_key'] ) ) {
-                       $groupby = "{$wpdb->posts}.ID";
-               }
-
                // Author/user stuff
 
                if ( empty($q['author']) || ($q['author'] == '0') ) {
@@ -2389,13 +2389,15 @@ class WP_Query {
                        $read_private_cap = 'read_private_' . $post_type_cap . 's';
                }
 
-               if ( isset($q['post_status']) && '' != $q['post_status'] ) {
+               if ( ! empty( $q['post_status'] ) ) {
                        $statuswheres = array();
-                       $q_status = explode(',', $q['post_status']);
+                       $q_status = $q['post_status'];
+                       if ( ! is_array( $q_status ) )
+                               $q_status = explode(',', $q_status);
                        $r_status = array();
                        $p_status = array();
                        $e_status = array();
-                       if ( $q['post_status'] == 'any' ) {
+                       if ( in_array('any', $q_status) ) {
                                foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status )
                                        $e_status[] = "$wpdb->posts.post_status <> '$status'";
                        } else {
@@ -2480,6 +2482,10 @@ class WP_Query {
                        $where .= $clauses['where'];
                }
 
+               if ( ! empty( $this->tax_query->queries ) || ! empty( $q['meta_query'] ) ) {
+                       $groupby = "{$wpdb->posts}.ID";
+               }
+
                // Apply filters on where and join prior to paging so that any
                // manipulations to them are reflected in the paging by day queries.
                if ( !$q['suppress_filters'] ) {