Make WordPress Core

Ticket #41339: 41339.diff

File 41339.diff, 1.7 KB (added by pbiron, 8 years ago)

allow status__not_in parameter

  • src/wp-includes/class-wp-comment-query.php

    diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php
    index 25b7fcf..3e1b103 100644
    a b class WP_Comment_Query { 
    235235         *     @type string       $status                    Comment status to limit results by. Accepts 'hold'
    236236         *                                                   (`comment_status=0`), 'approve' (`comment_status=1`),
    237237         *                                                   'all', or a custom comment status. Default 'all'.
     238         *     @type array        $status__not_in            Exclude comments from a given array of comment stati.
     239         *                                                   Default empty.
    238240         *     @type string|array $type                      Include comments of a given type, or array of types.
    239241         *                                                   Accepts 'comment', 'pings' (includes 'pingback' and
    240242         *                                                   'trackback'), or anycustom type string. Default empty.
    class WP_Comment_Query { 
    291293                        'post_status' => '',
    292294                        'post_type' => '',
    293295                        'status' => 'all',
     296                        'status__not_in' => '',
    294297                        'type' => '',
    295298                        'type__in' => '',
    296299                        'type__not_in' => '',
    class WP_Comment_Query { 
    493496                        $statuses = preg_split( '/[\s,]+/', $statuses );
    494497                }
    495498
     499                // unlink 'status', 'status__not_in' accepts only an array
     500                $status__not_in = $this->query_vars['status__not_in'];
     501                $statuses = array_diff( $statuses, $status__not_in );
     502                unset( $status__not_in );
     503
    496504                // 'any' overrides other statuses.
    497505                if ( ! in_array( 'any', $statuses ) ) {
    498506                        foreach ( $statuses as $status ) {