Ticket #17592: 17592.diff
File 17592.diff, 1.4 KB (added by , 14 years ago) |
---|
-
wp-includes/query.php
2374 2374 } 2375 2375 2376 2376 $exclude_post_types = ''; 2377 $in_search_post_types = get_post_types( array('exclude_from_search' => false) );2378 if ( ! empty( $in_search_post_types ) )2379 $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')");2380 2377 2378 if ( $this->is_search() ) { 2379 $in_search_post_types = get_post_types( array('exclude_from_search' => false) ); 2380 if ( ! empty( $in_search_post_types ) ) 2381 $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')"); 2382 } 2383 2381 2384 if ( 'any' == $post_type ) { 2382 2385 $where .= $exclude_post_types; 2383 2386 } elseif ( !empty( $post_type ) && is_array( $post_type ) ) { … … 2417 2420 $p_status = array(); 2418 2421 $e_status = array(); 2419 2422 if ( in_array('any', $q_status) ) { 2420 foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status ) 2421 $e_status[] = "$wpdb->posts.post_status <> '$status'"; 2423 if ( $this->is_search() ) { 2424 foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status ) 2425 $e_status[] = "$wpdb->posts.post_status <> '$status'"; 2426 } 2422 2427 } else { 2423 2428 foreach ( get_post_stati() as $status ) { 2424 2429 if ( in_array( $status, $q_status ) ) {