+ // 'post_status' and 'post_type' are handled separately, due to the specialized behavior of 'any'.
+ foreach ( array( 'post_status', 'post_type' ) as $field_name ) {
+ $q_values = array();
+ if ( ! empty( $this->query_vars[ $field_name ] ) ) {
+ $q_values = $this->query_vars[ $field_name ];
+ if ( ! is_array( $q_values ) ) {
+ $q_values = explode( ',', $q_values );
+ }
+
+ // 'any' will cause the query var to be ignored.
+ if ( in_array( 'any', $q_values, true ) || empty( $q_values ) ) {
+ continue;
+ }
+
+ $join_posts_table = true;
+
+ $esses = array_fill( 0, count( $q_values ), '%s' );
+ $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ")", $q_values );
+ }
+ }
+