Changeset 25239
- Timestamp:
- 09/04/2013 06:50:04 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r25238 r25239 2456 2456 if ( 'any' == $post_type ) { 2457 2457 $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 2459 2461 $where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')"; 2460 2462 } elseif ( !empty( $post_type ) && is_array( $post_type ) ) { -
trunk/tests/phpunit/tests/query/results.php
r25002 r25239 370 370 ), wp_list_pluck( $posts, 'post_title' ) ); 371 371 } 372 373 function test_exlude_from_search_empty() { 374 global $wp_post_types; 375 foreach ( array_keys( $wp_post_types ) as $slug ) 376 $wp_post_types[$slug]->exclude_from_search = true; 377 378 $posts = $this->q->query( array( 'post_type' => 'any' ) ); 379 380 $this->assertEmpty( $posts ); 381 $this->assertRegExp( '#AND 1=0#', $this->q->request ); 382 383 foreach ( array_keys( $wp_post_types ) as $slug ) 384 $wp_post_types[$slug]->exclude_from_search = false; 385 386 $posts2 = $this->q->query( array( 'post_type' => 'any' ) ); 387 388 $this->assertNotEmpty( $posts2 ); 389 $this->assertNotRegExp( '#AND 1=0#', $this->q->request ); 390 } 372 391 }
Note: See TracChangeset
for help on using the changeset viewer.