Ticket #44737: 44737.diff
| File 44737.diff, 1.1 KB (added by , 7 years ago) |
|---|
-
src/wp-includes/class-wp-query.php
2443 2443 } elseif ( ! $this->is_singular ) { 2444 2444 $where .= " AND ({$wpdb->posts}.post_status = 'publish'"; 2445 2445 2446 // States excluded from search. Used inside the foreach just ahead. 2447 $states_excluded_from_search = array(); 2448 if ( $this->is_search ) { 2449 $states_excluded_from_search = get_post_stati( array( 'exclude_from_search' => true ) ); 2450 } 2451 2446 2452 // Add public states. 2447 2453 $public_states = get_post_stati( array( 'public' => true ) ); 2448 2454 foreach ( (array) $public_states as $state ) { 2449 if ( 'publish' == $state ) { // Publish is hard-coded above. 2455 // Publish is hard-coded above. 2456 if ( 'publish' == $state ) { 2450 2457 continue; 2451 2458 } 2459 // If is search, states excluded from it don't enter in the list. 2460 if ( $this->is_search && in_array( $state, $states_excluded_from_search ) ) { 2461 continue; 2462 } 2452 2463 $where .= " OR {$wpdb->posts}.post_status = '$state'"; 2453 2464 } 2454 2465