Make WordPress Core


Ignore:
Timestamp:
05/29/2014 08:41:53 PM (11 years ago)
Author:
wonderboymusic
Message:

If post_status is passed to WP_Query as an array containing 'any' and anything else, don't exclude the other values if they match when running any's exclusion logic.

Adds unit tests.

Fixes #28007.

File:
1 edited

Legend:

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

    r28613 r28622  
    27682768            $p_status = array();
    27692769            $e_status = array();
    2770             if ( in_array('any', $q_status) ) {
    2771                 foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status )
    2772                     $e_status[] = "$wpdb->posts.post_status <> '$status'";
     2770            if ( in_array( 'any', $q_status ) ) {
     2771                foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {
     2772                    if ( ! in_array( $status, $q_status ) ) {
     2773                        $e_status[] = "$wpdb->posts.post_status <> '$status'";
     2774                    }
     2775                }
    27732776            } else {
    27742777                foreach ( get_post_stati() as $status ) {
Note: See TracChangeset for help on using the changeset viewer.