Ticket #17592: 17592.2.diff
File 17592.2.diff, 1.5 KB (added by , 13 years ago) |
---|
-
wp-includes/query.php
2386 2386 } 2387 2387 2388 2388 if ( 'any' == $post_type ) { 2389 $in_search_post_types = get_post_types( array('exclude_from_search' => false) ); 2390 if ( ! empty( $in_search_post_types ) ) 2391 $where .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')"); 2389 if ( $this->is_search() ) { 2390 $in_search_post_types = get_post_types( array('exclude_from_search' => false) ); 2391 if ( ! empty( $in_search_post_types ) ) 2392 $where .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')"); 2393 } 2392 2394 } elseif ( !empty( $post_type ) && is_array( $post_type ) ) { 2393 2395 $where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')"; 2394 2396 } elseif ( ! empty( $post_type ) ) { … … 2426 2428 $p_status = array(); 2427 2429 $e_status = array(); 2428 2430 if ( in_array('any', $q_status) ) { 2429 foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status ) 2430 $e_status[] = "$wpdb->posts.post_status <> '$status'"; 2431 if ( $this->is_search() ) { 2432 foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status ) 2433 $e_status[] = "$wpdb->posts.post_status <> '$status'"; 2434 } 2431 2435 } else { 2432 2436 foreach ( get_post_stati() as $status ) { 2433 2437 if ( in_array( $status, $q_status ) ) {