Make WordPress Core

Changeset 19078


Ignore:
Timestamp:
10/28/2011 08:03:26 PM (15 years ago)
Author:
ryan
Message:

Compute in_search_post_types only when needed. Props mitchoyoshitaka. fixes #18364

File:
1 edited

Legend:

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

    r18995 r19078  
    23862386                }
    23872387
    2388                 $exclude_post_types = '';
    2389                 $in_search_post_types = get_post_types( array('exclude_from_search' => false) );
    2390                 if ( ! empty( $in_search_post_types ) )
    2391                         $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')");
    2392 
    23932388                if ( 'any' == $post_type ) {
    2394                         $where .= $exclude_post_types;
     2389                        $exclude_post_types = '';
     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 ) . "')");
    23952393                } elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
    23962394                        $where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
Note: See TracChangeset for help on using the changeset viewer.