WordPress.org

Make WordPress Core

Ticket #13183: 13183.diff

File 13183.diff, 787 bytes (added by sivel, 8 years ago)
  • query.php

     
    21602160                }
    21612161
    21622162                $exclude_post_types = '';
    2163                 foreach ( get_post_types( array('exclude_from_search' => true) ) as $_wp_post_type )
    2164                         $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $_wp_post_type);
     2163                $in_search_post_types = get_post_types( array('exclude_from_search' => false) );
     2164                if ( ! empty( $in_search_post_types ) )
     2165                        $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')");
    21652166
    21662167                if ( 'any' == $post_type ) {
    21672168                        $where .= $exclude_post_types;
     
    28472848
    28482849        return true;
    28492850}
    2850 ?>
    2851  No newline at end of file
     2851?>