Make WordPress Core


Ignore:
Timestamp:
09/04/2013 06:50:04 PM (11 years ago)
Author:
wonderboymusic
Message:

Kill the query in the following edge case: post_type => 'any' but exclude_from_search => false returns no valid post types. Adds unit tests.

Props mitchoyoshitaka.
Fixes #19198.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r25238 r25239  
    24562456        if ( 'any' == $post_type ) {
    24572457            $in_search_post_types = get_post_types( array('exclude_from_search' => false) );
    2458             if ( ! empty( $in_search_post_types ) )
     2458            if ( empty( $in_search_post_types ) )
     2459                $where .= ' AND 1=0 ';
     2460            else   
    24592461                $where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
    24602462        } elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
Note: See TracChangeset for help on using the changeset viewer.