Make WordPress Core

Changeset 60927


Ignore:
Timestamp:
10/13/2025 09:37:03 PM (3 months ago)
Author:
peterwilsoncc
Message:

Coding Standards: Rename abbreviated variables in WP_Query.

Renames the locally scoped references to WP_Query::$query_vars from $q/$qv to $query_vars for clarity per the coding standards' naming conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See #63168.

File:
1 edited

Legend:

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

    r60697 r60927  
    811811
    812812        $this->query_vars         = $this->fill_query_vars( $this->query_vars );
    813         $qv                       = &$this->query_vars;
     813        $query_vars               = &$this->query_vars;
    814814        $this->query_vars_changed = true;
    815815
    816         if ( ! empty( $qv['robots'] ) ) {
     816        if ( ! empty( $query_vars['robots'] ) ) {
    817817            $this->is_robots = true;
    818         } elseif ( ! empty( $qv['favicon'] ) ) {
     818        } elseif ( ! empty( $query_vars['favicon'] ) ) {
    819819            $this->is_favicon = true;
    820820        }
    821821
    822         if ( ! is_scalar( $qv['p'] ) || (int) $qv['p'] < 0 ) {
    823             $qv['p']     = 0;
    824             $qv['error'] = '404';
     822        if ( ! is_scalar( $query_vars['p'] ) || (int) $query_vars['p'] < 0 ) {
     823            $query_vars['p']     = 0;
     824            $query_vars['error'] = '404';
    825825        } else {
    826             $qv['p'] = (int) $qv['p'];
    827         }
    828 
    829         $qv['page_id']  = is_scalar( $qv['page_id'] ) ? absint( $qv['page_id'] ) : 0;
    830         $qv['year']     = is_scalar( $qv['year'] ) ? absint( $qv['year'] ) : 0;
    831         $qv['monthnum'] = is_scalar( $qv['monthnum'] ) ? absint( $qv['monthnum'] ) : 0;
    832         $qv['day']      = is_scalar( $qv['day'] ) ? absint( $qv['day'] ) : 0;
    833         $qv['w']        = is_scalar( $qv['w'] ) ? absint( $qv['w'] ) : 0;
    834         $qv['m']        = is_scalar( $qv['m'] ) ? preg_replace( '|[^0-9]|', '', $qv['m'] ) : '';
    835         $qv['paged']    = is_scalar( $qv['paged'] ) ? absint( $qv['paged'] ) : 0;
    836         $qv['cat']      = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // Array or comma-separated list of positive or negative integers.
    837         $qv['author']   = is_scalar( $qv['author'] ) ? preg_replace( '|[^0-9,-]|', '', $qv['author'] ) : ''; // Comma-separated list of positive or negative integers.
    838         $qv['pagename'] = is_scalar( $qv['pagename'] ) ? trim( $qv['pagename'] ) : '';
    839         $qv['name']     = is_scalar( $qv['name'] ) ? trim( $qv['name'] ) : '';
    840         $qv['title']    = is_scalar( $qv['title'] ) ? trim( $qv['title'] ) : '';
    841 
    842         if ( is_scalar( $qv['hour'] ) && '' !== $qv['hour'] ) {
    843             $qv['hour'] = absint( $qv['hour'] );
     826            $query_vars['p'] = (int) $query_vars['p'];
     827        }
     828
     829        $query_vars['page_id']  = is_scalar( $query_vars['page_id'] ) ? absint( $query_vars['page_id'] ) : 0;
     830        $query_vars['year']     = is_scalar( $query_vars['year'] ) ? absint( $query_vars['year'] ) : 0;
     831        $query_vars['monthnum'] = is_scalar( $query_vars['monthnum'] ) ? absint( $query_vars['monthnum'] ) : 0;
     832        $query_vars['day']      = is_scalar( $query_vars['day'] ) ? absint( $query_vars['day'] ) : 0;
     833        $query_vars['w']        = is_scalar( $query_vars['w'] ) ? absint( $query_vars['w'] ) : 0;
     834        $query_vars['m']        = is_scalar( $query_vars['m'] ) ? preg_replace( '|[^0-9]|', '', $query_vars['m'] ) : '';
     835        $query_vars['paged']    = is_scalar( $query_vars['paged'] ) ? absint( $query_vars['paged'] ) : 0;
     836        $query_vars['cat']      = preg_replace( '|[^0-9,-]|', '', $query_vars['cat'] ); // Array or comma-separated list of positive or negative integers.
     837        $query_vars['author']   = is_scalar( $query_vars['author'] ) ? preg_replace( '|[^0-9,-]|', '', $query_vars['author'] ) : ''; // Comma-separated list of positive or negative integers.
     838        $query_vars['pagename'] = is_scalar( $query_vars['pagename'] ) ? trim( $query_vars['pagename'] ) : '';
     839        $query_vars['name']     = is_scalar( $query_vars['name'] ) ? trim( $query_vars['name'] ) : '';
     840        $query_vars['title']    = is_scalar( $query_vars['title'] ) ? trim( $query_vars['title'] ) : '';
     841
     842        if ( is_scalar( $query_vars['hour'] ) && '' !== $query_vars['hour'] ) {
     843            $query_vars['hour'] = absint( $query_vars['hour'] );
    844844        } else {
    845             $qv['hour'] = '';
    846         }
    847 
    848         if ( is_scalar( $qv['minute'] ) && '' !== $qv['minute'] ) {
    849             $qv['minute'] = absint( $qv['minute'] );
     845            $query_vars['hour'] = '';
     846        }
     847
     848        if ( is_scalar( $query_vars['minute'] ) && '' !== $query_vars['minute'] ) {
     849            $query_vars['minute'] = absint( $query_vars['minute'] );
    850850        } else {
    851             $qv['minute'] = '';
    852         }
    853 
    854         if ( is_scalar( $qv['second'] ) && '' !== $qv['second'] ) {
    855             $qv['second'] = absint( $qv['second'] );
     851            $query_vars['minute'] = '';
     852        }
     853
     854        if ( is_scalar( $query_vars['second'] ) && '' !== $query_vars['second'] ) {
     855            $query_vars['second'] = absint( $query_vars['second'] );
    856856        } else {
    857             $qv['second'] = '';
    858         }
    859 
    860         if ( is_scalar( $qv['menu_order'] ) && '' !== $qv['menu_order'] ) {
    861             $qv['menu_order'] = absint( $qv['menu_order'] );
     857            $query_vars['second'] = '';
     858        }
     859
     860        if ( is_scalar( $query_vars['menu_order'] ) && '' !== $query_vars['menu_order'] ) {
     861            $query_vars['menu_order'] = absint( $query_vars['menu_order'] );
    862862        } else {
    863             $qv['menu_order'] = '';
     863            $query_vars['menu_order'] = '';
    864864        }
    865865
    866866        // Fairly large, potentially too large, upper bound for search string lengths.
    867         if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {
    868             $qv['s'] = '';
     867        if ( ! is_scalar( $query_vars['s'] ) || ( ! empty( $query_vars['s'] ) && strlen( $query_vars['s'] ) > 1600 ) ) {
     868            $query_vars['s'] = '';
    869869        }
    870870
    871871        // Compat. Map subpost to attachment.
    872         if ( is_scalar( $qv['subpost'] ) && '' != $qv['subpost'] ) {
    873             $qv['attachment'] = $qv['subpost'];
    874         }
    875         if ( is_scalar( $qv['subpost_id'] ) && '' != $qv['subpost_id'] ) {
    876             $qv['attachment_id'] = $qv['subpost_id'];
    877         }
    878 
    879         $qv['attachment_id'] = is_scalar( $qv['attachment_id'] ) ? absint( $qv['attachment_id'] ) : 0;
    880 
    881         if ( ( '' !== $qv['attachment'] ) || ! empty( $qv['attachment_id'] ) ) {
     872        if ( is_scalar( $query_vars['subpost'] ) && '' != $query_vars['subpost'] ) {
     873            $query_vars['attachment'] = $query_vars['subpost'];
     874        }
     875        if ( is_scalar( $query_vars['subpost_id'] ) && '' != $query_vars['subpost_id'] ) {
     876            $query_vars['attachment_id'] = $query_vars['subpost_id'];
     877        }
     878
     879        $query_vars['attachment_id'] = is_scalar( $query_vars['attachment_id'] ) ? absint( $query_vars['attachment_id'] ) : 0;
     880
     881        if ( ( '' !== $query_vars['attachment'] ) || ! empty( $query_vars['attachment_id'] ) ) {
    882882            $this->is_single     = true;
    883883            $this->is_attachment = true;
    884         } elseif ( '' !== $qv['name'] ) {
     884        } elseif ( '' !== $query_vars['name'] ) {
    885885            $this->is_single = true;
    886         } elseif ( $qv['p'] ) {
     886        } elseif ( $query_vars['p'] ) {
    887887            $this->is_single = true;
    888         } elseif ( '' !== $qv['pagename'] || ! empty( $qv['page_id'] ) ) {
     888        } elseif ( '' !== $query_vars['pagename'] || ! empty( $query_vars['page_id'] ) ) {
    889889            $this->is_page   = true;
    890890            $this->is_single = false;
     
    896896            }
    897897
    898             if ( '' !== $qv['second'] ) {
     898            if ( '' !== $query_vars['second'] ) {
    899899                $this->is_time = true;
    900900                $this->is_date = true;
    901901            }
    902902
    903             if ( '' !== $qv['minute'] ) {
     903            if ( '' !== $query_vars['minute'] ) {
    904904                $this->is_time = true;
    905905                $this->is_date = true;
    906906            }
    907907
    908             if ( '' !== $qv['hour'] ) {
     908            if ( '' !== $query_vars['hour'] ) {
    909909                $this->is_time = true;
    910910                $this->is_date = true;
    911911            }
    912912
    913             if ( $qv['day'] ) {
     913            if ( $query_vars['day'] ) {
    914914                if ( ! $this->is_date ) {
    915                     $date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] );
    916                     if ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) {
    917                         $qv['error'] = '404';
     915                    $date = sprintf( '%04d-%02d-%02d', $query_vars['year'], $query_vars['monthnum'], $query_vars['day'] );
     916                    if ( $query_vars['monthnum'] && $query_vars['year'] && ! wp_checkdate( $query_vars['monthnum'], $query_vars['day'], $query_vars['year'], $date ) ) {
     917                        $query_vars['error'] = '404';
    918918                    } else {
    919919                        $this->is_day  = true;
     
    923923            }
    924924
    925             if ( $qv['monthnum'] ) {
     925            if ( $query_vars['monthnum'] ) {
    926926                if ( ! $this->is_date ) {
    927                     if ( 12 < $qv['monthnum'] ) {
    928                         $qv['error'] = '404';
     927                    if ( 12 < $query_vars['monthnum'] ) {
     928                        $query_vars['error'] = '404';
    929929                    } else {
    930930                        $this->is_month = true;
     
    934934            }
    935935
    936             if ( $qv['year'] ) {
     936            if ( $query_vars['year'] ) {
    937937                if ( ! $this->is_date ) {
    938938                    $this->is_year = true;
     
    941941            }
    942942
    943             if ( $qv['m'] ) {
     943            if ( $query_vars['m'] ) {
    944944                $this->is_date = true;
    945                 if ( strlen( $qv['m'] ) > 9 ) {
     945                if ( strlen( $query_vars['m'] ) > 9 ) {
    946946                    $this->is_time = true;
    947                 } elseif ( strlen( $qv['m'] ) > 7 ) {
     947                } elseif ( strlen( $query_vars['m'] ) > 7 ) {
    948948                    $this->is_day = true;
    949                 } elseif ( strlen( $qv['m'] ) > 5 ) {
     949                } elseif ( strlen( $query_vars['m'] ) > 5 ) {
    950950                    $this->is_month = true;
    951951                } else {
     
    954954            }
    955955
    956             if ( $qv['w'] ) {
     956            if ( $query_vars['w'] ) {
    957957                $this->is_date = true;
    958958            }
    959959
    960960            $this->query_vars_hash = false;
    961             $this->parse_tax_query( $qv );
     961            $this->parse_tax_query( $query_vars );
    962962
    963963            foreach ( $this->tax_query->queries as $tax_query ) {
     
    981981            unset( $tax_query );
    982982
    983             if ( empty( $qv['author'] ) || ( '0' == $qv['author'] ) ) {
     983            if ( empty( $query_vars['author'] ) || ( '0' == $query_vars['author'] ) ) {
    984984                $this->is_author = false;
    985985            } else {
     
    987987            }
    988988
    989             if ( '' !== $qv['author_name'] ) {
     989            if ( '' !== $query_vars['author_name'] ) {
    990990                $this->is_author = true;
    991991            }
    992992
    993             if ( ! empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {
    994                 $post_type_obj = get_post_type_object( $qv['post_type'] );
     993            if ( ! empty( $query_vars['post_type'] ) && ! is_array( $query_vars['post_type'] ) ) {
     994                $post_type_obj = get_post_type_object( $query_vars['post_type'] );
    995995                if ( ! empty( $post_type_obj->has_archive ) ) {
    996996                    $this->is_post_type_archive = true;
     
    10031003        }
    10041004
    1005         if ( '' != $qv['feed'] ) {
     1005        if ( '' != $query_vars['feed'] ) {
    10061006            $this->is_feed = true;
    10071007        }
    10081008
    1009         if ( '' != $qv['embed'] ) {
     1009        if ( '' != $query_vars['embed'] ) {
    10101010            $this->is_embed = true;
    10111011        }
    10121012
    1013         if ( '' != $qv['tb'] ) {
     1013        if ( '' != $query_vars['tb'] ) {
    10141014            $this->is_trackback = true;
    10151015        }
    10161016
    1017         if ( '' != $qv['paged'] && ( (int) $qv['paged'] > 1 ) ) {
     1017        if ( '' != $query_vars['paged'] && ( (int) $query_vars['paged'] > 1 ) ) {
    10181018            $this->is_paged = true;
    10191019        }
    10201020
    10211021        // If we're previewing inside the write screen.
    1022         if ( '' != $qv['preview'] ) {
     1022        if ( '' != $query_vars['preview'] ) {
    10231023            $this->is_preview = true;
    10241024        }
     
    10281028        }
    10291029
    1030         if ( str_contains( $qv['feed'], 'comments-' ) ) {
    1031             $qv['feed']         = str_replace( 'comments-', '', $qv['feed'] );
    1032             $qv['withcomments'] = 1;
     1030        if ( str_contains( $query_vars['feed'], 'comments-' ) ) {
     1031            $query_vars['feed']         = str_replace( 'comments-', '', $query_vars['feed'] );
     1032            $query_vars['withcomments'] = 1;
    10331033        }
    10341034
    10351035        $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
    10361036
    1037         if ( $this->is_feed && ( ! empty( $qv['withcomments'] ) || ( empty( $qv['withoutcomments'] ) && $this->is_singular ) ) ) {
     1037        if ( $this->is_feed && ( ! empty( $query_vars['withcomments'] ) || ( empty( $query_vars['withoutcomments'] ) && $this->is_singular ) ) ) {
    10381038            $this->is_comment_feed = true;
    10391039        }
     
    10561056
    10571057            if ( empty( $_query ) || ! array_diff( array_keys( $_query ), array( 'preview', 'page', 'paged', 'cpage' ) ) ) {
    1058                 $this->is_page = true;
    1059                 $this->is_home = false;
    1060                 $qv['page_id'] = get_option( 'page_on_front' );
     1058                $this->is_page         = true;
     1059                $this->is_home         = false;
     1060                $query_vars['page_id'] = get_option( 'page_on_front' );
    10611061                // Correct <!--nextpage--> for 'page_on_front'.
    1062                 if ( ! empty( $qv['paged'] ) ) {
    1063                     $qv['page'] = $qv['paged'];
    1064                     unset( $qv['paged'] );
    1065                 }
    1066             }
    1067         }
    1068 
    1069         if ( '' !== $qv['pagename'] ) {
    1070             $this->queried_object = get_page_by_path( $qv['pagename'] );
     1062                if ( ! empty( $query_vars['paged'] ) ) {
     1063                    $query_vars['page'] = $query_vars['paged'];
     1064                    unset( $query_vars['paged'] );
     1065                }
     1066            }
     1067        }
     1068
     1069        if ( '' !== $query_vars['pagename'] ) {
     1070            $this->queried_object = get_page_by_path( $query_vars['pagename'] );
    10711071
    10721072            if ( $this->queried_object && 'attachment' === $this->queried_object->post_type ) {
    10731073                if ( preg_match( '/^[^%]*%(?:postname)%/', get_option( 'permalink_structure' ) ) ) {
    10741074                    // See if we also have a post with the same slug.
    1075                     $post = get_page_by_path( $qv['pagename'], OBJECT, 'post' );
     1075                    $post = get_page_by_path( $query_vars['pagename'], OBJECT, 'post' );
    10761076                    if ( $post ) {
    10771077                        $this->queried_object = $post;
     
    10991099        }
    11001100
    1101         if ( $qv['page_id'] ) {
    1102             if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == $qv['page_id'] ) {
     1101        if ( $query_vars['page_id'] ) {
     1102            if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == $query_vars['page_id'] ) {
    11031103                $this->is_page       = false;
    11041104                $this->is_home       = true;
     
    11061106            }
    11071107
    1108             if ( get_option( 'wp_page_for_privacy_policy' ) == $qv['page_id'] ) {
     1108            if ( get_option( 'wp_page_for_privacy_policy' ) == $query_vars['page_id'] ) {
    11091109                $this->is_privacy_policy = true;
    11101110            }
    11111111        }
    11121112
    1113         if ( ! empty( $qv['post_type'] ) ) {
    1114             if ( is_array( $qv['post_type'] ) ) {
    1115                 $qv['post_type'] = array_map( 'sanitize_key', array_unique( $qv['post_type'] ) );
    1116                 sort( $qv['post_type'] );
     1113        if ( ! empty( $query_vars['post_type'] ) ) {
     1114            if ( is_array( $query_vars['post_type'] ) ) {
     1115                $query_vars['post_type'] = array_map( 'sanitize_key', array_unique( $query_vars['post_type'] ) );
     1116                sort( $query_vars['post_type'] );
    11171117            } else {
    1118                 $qv['post_type'] = sanitize_key( $qv['post_type'] );
    1119             }
    1120         }
    1121 
    1122         if ( ! empty( $qv['post_status'] ) ) {
    1123             if ( is_array( $qv['post_status'] ) ) {
    1124                 $qv['post_status'] = array_map( 'sanitize_key', array_unique( $qv['post_status'] ) );
    1125                 sort( $qv['post_status'] );
     1118                $query_vars['post_type'] = sanitize_key( $query_vars['post_type'] );
     1119            }
     1120        }
     1121
     1122        if ( ! empty( $query_vars['post_status'] ) ) {
     1123            if ( is_array( $query_vars['post_status'] ) ) {
     1124                $query_vars['post_status'] = array_map( 'sanitize_key', array_unique( $query_vars['post_status'] ) );
     1125                sort( $query_vars['post_status'] );
    11261126            } else {
    1127                 $qv['post_status'] = preg_replace( '|[^a-z0-9_,-]|', '', $qv['post_status'] );
    1128             }
    1129         }
    1130 
    1131         if ( $this->is_posts_page && ( ! isset( $qv['withcomments'] ) || ! $qv['withcomments'] ) ) {
     1127                $query_vars['post_status'] = preg_replace( '|[^a-z0-9_,-]|', '', $query_vars['post_status'] );
     1128            }
     1129        }
     1130
     1131        if ( $this->is_posts_page && ( ! isset( $query_vars['withcomments'] ) || ! $query_vars['withcomments'] ) ) {
    11321132            $this->is_comment_feed = false;
    11331133        }
     
    11361136        // Done correcting `is_*` for 'page_on_front' and 'page_for_posts'.
    11371137
    1138         if ( '404' == $qv['error'] ) {
     1138        if ( '404' == $query_vars['error'] ) {
    11391139            $this->set_404();
    11401140        }
     
    11621162     * @since 3.1.0
    11631163     *
    1164      * @param array $q The query variables. Passed by reference.
    1165      */
    1166     public function parse_tax_query( &$q ) {
    1167         if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) {
    1168             $tax_query = $q['tax_query'];
     1164     * @param array $query_vars The query variables. Passed by reference.
     1165     */
     1166    public function parse_tax_query( &$query_vars ) {
     1167        if ( ! empty( $query_vars['tax_query'] ) && is_array( $query_vars['tax_query'] ) ) {
     1168            $tax_query = $query_vars['tax_query'];
    11691169        } else {
    11701170            $tax_query = array();
    11711171        }
    11721172
    1173         if ( ! empty( $q['taxonomy'] ) && ! empty( $q['term'] ) ) {
     1173        if ( ! empty( $query_vars['taxonomy'] ) && ! empty( $query_vars['term'] ) ) {
    11741174            $tax_query[] = array(
    1175                 'taxonomy' => $q['taxonomy'],
    1176                 'terms'    => array( $q['term'] ),
     1175                'taxonomy' => $query_vars['taxonomy'],
     1176                'terms'    => array( $query_vars['term'] ),
    11771177                'field'    => 'slug',
    11781178            );
     
    11841184            }
    11851185
    1186             if ( $t->query_var && ! empty( $q[ $t->query_var ] ) ) {
     1186            if ( $t->query_var && ! empty( $query_vars[ $t->query_var ] ) ) {
    11871187                $tax_query_defaults = array(
    11881188                    'taxonomy' => $taxonomy,
     
    11911191
    11921192                if ( ! empty( $t->rewrite['hierarchical'] ) ) {
    1193                     $q[ $t->query_var ] = wp_basename( $q[ $t->query_var ] );
    1194                 }
    1195 
    1196                 $term = $q[ $t->query_var ];
     1193                    $query_vars[ $t->query_var ] = wp_basename( $query_vars[ $t->query_var ] );
     1194                }
     1195
     1196                $term = $query_vars[ $t->query_var ];
    11971197
    11981198                if ( ! is_array( $term ) ) {
     
    12251225
    12261226        // If query string 'cat' is an array, implode it.
    1227         if ( is_array( $q['cat'] ) ) {
    1228             $q['cat'] = implode( ',', $q['cat'] );
     1227        if ( is_array( $query_vars['cat'] ) ) {
     1228            $query_vars['cat'] = implode( ',', $query_vars['cat'] );
    12291229        }
    12301230
    12311231        // Category stuff.
    12321232
    1233         if ( ! empty( $q['cat'] ) && ! $this->is_singular ) {
     1233        if ( ! empty( $query_vars['cat'] ) && ! $this->is_singular ) {
    12341234            $cat_in     = array();
    12351235            $cat_not_in = array();
    12361236
    1237             $cat_array = preg_split( '/[,\s]+/', urldecode( $q['cat'] ) );
     1237            $cat_array = preg_split( '/[,\s]+/', urldecode( $query_vars['cat'] ) );
    12381238            $cat_array = array_map( 'intval', $cat_array );
    12391239            sort( $cat_array );
    1240             $q['cat'] = implode( ',', $cat_array );
     1240            $query_vars['cat'] = implode( ',', $cat_array );
    12411241
    12421242            foreach ( $cat_array as $cat ) {
     
    12691269        }
    12701270
    1271         if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {
    1272             $q['category__and'] = (array) $q['category__and'];
    1273             if ( ! isset( $q['category__in'] ) ) {
    1274                 $q['category__in'] = array();
    1275             }
    1276             $q['category__in'][] = absint( reset( $q['category__and'] ) );
    1277             unset( $q['category__and'] );
    1278         }
    1279 
    1280         if ( ! empty( $q['category__in'] ) ) {
    1281             $q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) );
    1282             sort( $q['category__in'] );
     1271        if ( ! empty( $query_vars['category__and'] ) && 1 === count( (array) $query_vars['category__and'] ) ) {
     1272            $query_vars['category__and'] = (array) $query_vars['category__and'];
     1273            if ( ! isset( $query_vars['category__in'] ) ) {
     1274                $query_vars['category__in'] = array();
     1275            }
     1276            $query_vars['category__in'][] = absint( reset( $query_vars['category__and'] ) );
     1277            unset( $query_vars['category__and'] );
     1278        }
     1279
     1280        if ( ! empty( $query_vars['category__in'] ) ) {
     1281            $query_vars['category__in'] = array_map( 'absint', array_unique( (array) $query_vars['category__in'] ) );
     1282            sort( $query_vars['category__in'] );
    12831283            $tax_query[] = array(
    12841284                'taxonomy'         => 'category',
    1285                 'terms'            => $q['category__in'],
     1285                'terms'            => $query_vars['category__in'],
    12861286                'field'            => 'term_id',
    12871287                'include_children' => false,
     
    12891289        }
    12901290
    1291         if ( ! empty( $q['category__not_in'] ) ) {
    1292             $q['category__not_in'] = array_map( 'absint', array_unique( (array) $q['category__not_in'] ) );
    1293             sort( $q['category__not_in'] );
     1291        if ( ! empty( $query_vars['category__not_in'] ) ) {
     1292            $query_vars['category__not_in'] = array_map( 'absint', array_unique( (array) $query_vars['category__not_in'] ) );
     1293            sort( $query_vars['category__not_in'] );
    12941294            $tax_query[] = array(
    12951295                'taxonomy'         => 'category',
    1296                 'terms'            => $q['category__not_in'],
     1296                'terms'            => $query_vars['category__not_in'],
    12971297                'operator'         => 'NOT IN',
    12981298                'include_children' => false,
     
    13001300        }
    13011301
    1302         if ( ! empty( $q['category__and'] ) ) {
    1303             $q['category__and'] = array_map( 'absint', array_unique( (array) $q['category__and'] ) );
    1304             sort( $q['category__and'] );
     1302        if ( ! empty( $query_vars['category__and'] ) ) {
     1303            $query_vars['category__and'] = array_map( 'absint', array_unique( (array) $query_vars['category__and'] ) );
     1304            sort( $query_vars['category__and'] );
    13051305            $tax_query[] = array(
    13061306                'taxonomy'         => 'category',
    1307                 'terms'            => $q['category__and'],
     1307                'terms'            => $query_vars['category__and'],
    13081308                'field'            => 'term_id',
    13091309                'operator'         => 'AND',
     
    13131313
    13141314        // If query string 'tag' is array, implode it.
    1315         if ( is_array( $q['tag'] ) ) {
    1316             $q['tag'] = implode( ',', $q['tag'] );
     1315        if ( is_array( $query_vars['tag'] ) ) {
     1316            $query_vars['tag'] = implode( ',', $query_vars['tag'] );
    13171317        }
    13181318
    13191319        // Tag stuff.
    13201320
    1321         if ( '' !== $q['tag'] && ! $this->is_singular && $this->query_vars_changed ) {
    1322             if ( str_contains( $q['tag'], ',' ) ) {
     1321        if ( '' !== $query_vars['tag'] && ! $this->is_singular && $this->query_vars_changed ) {
     1322            if ( str_contains( $query_vars['tag'], ',' ) ) {
    13231323                // @todo Handle normalizing `tag` query string.
    1324                 $tags = preg_split( '/[,\r\n\t ]+/', $q['tag'] );
     1324                $tags = preg_split( '/[,\r\n\t ]+/', $query_vars['tag'] );
    13251325                foreach ( (array) $tags as $tag ) {
    1326                     $tag                 = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' );
    1327                     $q['tag_slug__in'][] = $tag;
    1328                     sort( $q['tag_slug__in'] );
    1329                 }
    1330             } elseif ( preg_match( '/[+\r\n\t ]+/', $q['tag'] ) || ! empty( $q['cat'] ) ) {
    1331                 $tags = preg_split( '/[+\r\n\t ]+/', $q['tag'] );
     1326                    $tag                          = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' );
     1327                    $query_vars['tag_slug__in'][] = $tag;
     1328                    sort( $query_vars['tag_slug__in'] );
     1329                }
     1330            } elseif ( preg_match( '/[+\r\n\t ]+/', $query_vars['tag'] ) || ! empty( $query_vars['cat'] ) ) {
     1331                $tags = preg_split( '/[+\r\n\t ]+/', $query_vars['tag'] );
    13321332                foreach ( (array) $tags as $tag ) {
    1333                     $tag                  = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' );
    1334                     $q['tag_slug__and'][] = $tag;
     1333                    $tag                           = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' );
     1334                    $query_vars['tag_slug__and'][] = $tag;
    13351335                }
    13361336            } else {
    1337                 $q['tag']            = sanitize_term_field( 'slug', $q['tag'], 0, 'post_tag', 'db' );
    1338                 $q['tag_slug__in'][] = $q['tag'];
    1339                 sort( $q['tag_slug__in'] );
    1340             }
    1341         }
    1342 
    1343         if ( ! empty( $q['tag_id'] ) ) {
    1344             $q['tag_id'] = absint( $q['tag_id'] );
     1337                $query_vars['tag']            = sanitize_term_field( 'slug', $query_vars['tag'], 0, 'post_tag', 'db' );
     1338                $query_vars['tag_slug__in'][] = $query_vars['tag'];
     1339                sort( $query_vars['tag_slug__in'] );
     1340            }
     1341        }
     1342
     1343        if ( ! empty( $query_vars['tag_id'] ) ) {
     1344            $query_vars['tag_id'] = absint( $query_vars['tag_id'] );
     1345            $tax_query[]          = array(
     1346                'taxonomy' => 'post_tag',
     1347                'terms'    => $query_vars['tag_id'],
     1348            );
     1349        }
     1350
     1351        if ( ! empty( $query_vars['tag__in'] ) ) {
     1352            $query_vars['tag__in'] = array_map( 'absint', array_unique( (array) $query_vars['tag__in'] ) );
     1353            sort( $query_vars['tag__in'] );
    13451354            $tax_query[] = array(
    13461355                'taxonomy' => 'post_tag',
    1347                 'terms'    => $q['tag_id'],
     1356                'terms'    => $query_vars['tag__in'],
    13481357            );
    13491358        }
    13501359
    1351         if ( ! empty( $q['tag__in'] ) ) {
    1352             $q['tag__in'] = array_map( 'absint', array_unique( (array) $q['tag__in'] ) );
    1353             sort( $q['tag__in'] );
     1360        if ( ! empty( $query_vars['tag__not_in'] ) ) {
     1361            $query_vars['tag__not_in'] = array_map( 'absint', array_unique( (array) $query_vars['tag__not_in'] ) );
     1362            sort( $query_vars['tag__not_in'] );
    13541363            $tax_query[] = array(
    13551364                'taxonomy' => 'post_tag',
    1356                 'terms'    => $q['tag__in'],
     1365                'terms'    => $query_vars['tag__not_in'],
     1366                'operator' => 'NOT IN',
    13571367            );
    13581368        }
    13591369
    1360         if ( ! empty( $q['tag__not_in'] ) ) {
    1361             $q['tag__not_in'] = array_map( 'absint', array_unique( (array) $q['tag__not_in'] ) );
    1362             sort( $q['tag__not_in'] );
     1370        if ( ! empty( $query_vars['tag__and'] ) ) {
     1371            $query_vars['tag__and'] = array_map( 'absint', array_unique( (array) $query_vars['tag__and'] ) );
     1372            sort( $query_vars['tag__and'] );
    13631373            $tax_query[] = array(
    13641374                'taxonomy' => 'post_tag',
    1365                 'terms'    => $q['tag__not_in'],
    1366                 'operator' => 'NOT IN',
     1375                'terms'    => $query_vars['tag__and'],
     1376                'operator' => 'AND',
    13671377            );
    13681378        }
    13691379
    1370         if ( ! empty( $q['tag__and'] ) ) {
    1371             $q['tag__and'] = array_map( 'absint', array_unique( (array) $q['tag__and'] ) );
    1372             sort( $q['tag__and'] );
     1380        if ( ! empty( $query_vars['tag_slug__in'] ) ) {
     1381            $query_vars['tag_slug__in'] = array_map( 'sanitize_title_for_query', array_unique( (array) $query_vars['tag_slug__in'] ) );
     1382            sort( $query_vars['tag_slug__in'] );
    13731383            $tax_query[] = array(
    13741384                'taxonomy' => 'post_tag',
    1375                 'terms'    => $q['tag__and'],
    1376                 'operator' => 'AND',
     1385                'terms'    => $query_vars['tag_slug__in'],
     1386                'field'    => 'slug',
    13771387            );
    13781388        }
    13791389
    1380         if ( ! empty( $q['tag_slug__in'] ) ) {
    1381             $q['tag_slug__in'] = array_map( 'sanitize_title_for_query', array_unique( (array) $q['tag_slug__in'] ) );
    1382             sort( $q['tag_slug__in'] );
     1390        if ( ! empty( $query_vars['tag_slug__and'] ) ) {
     1391            $query_vars['tag_slug__and'] = array_map( 'sanitize_title_for_query', array_unique( (array) $query_vars['tag_slug__and'] ) );
     1392            sort( $query_vars['tag_slug__and'] );
    13831393            $tax_query[] = array(
    13841394                'taxonomy' => 'post_tag',
    1385                 'terms'    => $q['tag_slug__in'],
    1386                 'field'    => 'slug',
    1387             );
    1388         }
    1389 
    1390         if ( ! empty( $q['tag_slug__and'] ) ) {
    1391             $q['tag_slug__and'] = array_map( 'sanitize_title_for_query', array_unique( (array) $q['tag_slug__and'] ) );
    1392             sort( $q['tag_slug__and'] );
    1393             $tax_query[] = array(
    1394                 'taxonomy' => 'post_tag',
    1395                 'terms'    => $q['tag_slug__and'],
     1395                'terms'    => $query_vars['tag_slug__and'],
    13961396                'field'    => 'slug',
    13971397                'operator' => 'AND',
     
    14181418     * @global wpdb $wpdb WordPress database abstraction object.
    14191419     *
    1420      * @param array $q Query variables.
     1420     * @param array $query_vars Query variables.
    14211421     * @return string WHERE clause.
    14221422     */
    1423     protected function parse_search( &$q ) {
     1423    protected function parse_search( &$query_vars ) {
    14241424        global $wpdb;
    14251425
     
    14271427
    14281428        // Added slashes screw with quote grouping when done early, so done later.
    1429         $q['s'] = stripslashes( $q['s'] );
     1429        $query_vars['s'] = stripslashes( $query_vars['s'] );
    14301430        if ( empty( $_GET['s'] ) && $this->is_main_query() ) {
    1431             $q['s'] = urldecode( $q['s'] );
     1431            $query_vars['s'] = urldecode( $query_vars['s'] );
    14321432        }
    14331433        // There are no line breaks in <input /> fields.
    1434         $q['s']                  = str_replace( array( "\r", "\n" ), '', $q['s'] );
    1435         $q['search_terms_count'] = 1;
    1436         if ( ! empty( $q['sentence'] ) ) {
    1437             $q['search_terms'] = array( $q['s'] );
     1434        $query_vars['s']                  = str_replace( array( "\r", "\n" ), '', $query_vars['s'] );
     1435        $query_vars['search_terms_count'] = 1;
     1436        if ( ! empty( $query_vars['sentence'] ) ) {
     1437            $query_vars['search_terms'] = array( $query_vars['s'] );
    14381438        } else {
    1439             if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches ) ) {
    1440                 $q['search_terms_count'] = count( $matches[0] );
    1441                 $q['search_terms']       = $this->parse_search_terms( $matches[0] );
     1439            if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $query_vars['s'], $matches ) ) {
     1440                $query_vars['search_terms_count'] = count( $matches[0] );
     1441                $query_vars['search_terms']       = $this->parse_search_terms( $matches[0] );
    14421442                // If the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence.
    1443                 if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 ) {
    1444                     $q['search_terms'] = array( $q['s'] );
     1443                if ( empty( $query_vars['search_terms'] ) || count( $query_vars['search_terms'] ) > 9 ) {
     1444                    $query_vars['search_terms'] = array( $query_vars['s'] );
    14451445                }
    14461446            } else {
    1447                 $q['search_terms'] = array( $q['s'] );
    1448             }
    1449         }
    1450 
    1451         $n                         = ! empty( $q['exact'] ) ? '' : '%';
    1452         $searchand                 = '';
    1453         $q['search_orderby_title'] = array();
     1447                $query_vars['search_terms'] = array( $query_vars['s'] );
     1448            }
     1449        }
     1450
     1451        $n                                  = ! empty( $query_vars['exact'] ) ? '' : '%';
     1452        $searchand                          = '';
     1453        $query_vars['search_orderby_title'] = array();
    14541454
    14551455        $default_search_columns = array( 'post_title', 'post_excerpt', 'post_content' );
    1456         $search_columns         = ! empty( $q['search_columns'] ) ? $q['search_columns'] : $default_search_columns;
     1456        $search_columns         = ! empty( $query_vars['search_columns'] ) ? $query_vars['search_columns'] : $default_search_columns;
    14571457        if ( ! is_array( $search_columns ) ) {
    14581458            $search_columns = array( $search_columns );
     
    14711471         * @param WP_Query $query          The current WP_Query instance.
    14721472         */
    1473         $search_columns = (array) apply_filters( 'post_search_columns', $search_columns, $q['s'], $this );
     1473        $search_columns = (array) apply_filters( 'post_search_columns', $search_columns, $query_vars['s'], $this );
    14741474
    14751475        // Use only supported search columns.
     
    14891489        $exclusion_prefix = apply_filters( 'wp_query_search_exclusion_prefix', '-' );
    14901490
    1491         foreach ( $q['search_terms'] as $term ) {
     1491        foreach ( $query_vars['search_terms'] as $term ) {
    14921492            // If there is an $exclusion_prefix, terms prefixed with it should be excluded.
    14931493            $exclude = $exclusion_prefix && str_starts_with( $term, $exclusion_prefix );
     
    15021502
    15031503            if ( $n && ! $exclude ) {
    1504                 $like                        = '%' . $wpdb->esc_like( $term ) . '%';
    1505                 $q['search_orderby_title'][] = $wpdb->prepare( "{$wpdb->posts}.post_title LIKE %s", $like );
     1504                $like                                 = '%' . $wpdb->esc_like( $term ) . '%';
     1505                $query_vars['search_orderby_title'][] = $wpdb->prepare( "{$wpdb->posts}.post_title LIKE %s", $like );
    15061506            }
    15071507
     
    16241624     * @global wpdb $wpdb WordPress database abstraction object.
    16251625     *
    1626      * @param array $q Query variables.
     1626     * @param array $query_vars Query variables.
    16271627     * @return string ORDER BY clause.
    16281628     */
    1629     protected function parse_search_order( &$q ) {
     1629    protected function parse_search_order( &$query_vars ) {
    16301630        global $wpdb;
    16311631
    1632         if ( $q['search_terms_count'] > 1 ) {
    1633             $num_terms = count( $q['search_orderby_title'] );
     1632        if ( $query_vars['search_terms_count'] > 1 ) {
     1633            $num_terms = count( $query_vars['search_orderby_title'] );
    16341634
    16351635            // If the search terms contain negative queries, don't bother ordering by sentence matches.
    16361636            $like = '';
    1637             if ( ! preg_match( '/(?:\s|^)\-/', $q['s'] ) ) {
    1638                 $like = '%' . $wpdb->esc_like( $q['s'] ) . '%';
     1637            if ( ! preg_match( '/(?:\s|^)\-/', $query_vars['s'] ) ) {
     1638                $like = '%' . $wpdb->esc_like( $query_vars['s'] ) . '%';
    16391639            }
    16401640
     
    16521652            if ( $num_terms < 7 ) {
    16531653                // All words in title.
    1654                 $search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';
     1654                $search_orderby .= 'WHEN ' . implode( ' AND ', $query_vars['search_orderby_title'] ) . ' THEN 2 ';
    16551655                // Any word in title, not needed when $num_terms == 1.
    16561656                if ( $num_terms > 1 ) {
    1657                     $search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
     1657                    $search_orderby .= 'WHEN ' . implode( ' OR ', $query_vars['search_orderby_title'] ) . ' THEN 3 ';
    16581658                }
    16591659            }
     
    16701670        } else {
    16711671            // Single word or sentence search.
    1672             $search_orderby = reset( $q['search_orderby_title'] ) . ' DESC';
     1672            $search_orderby = reset( $query_vars['search_orderby_title'] ) . ' DESC';
    16731673        }
    16741674
     
    19101910        do_action_ref_array( 'pre_get_posts', array( &$this ) );
    19111911
    1912         // Shorthand.
    1913         $q = &$this->query_vars;
     1912        // Locally scoped reference for easy of use.
     1913        $query_vars = &$this->query_vars;
    19141914
    19151915        // Fill again in case 'pre_get_posts' unset some vars.
    1916         $q = $this->fill_query_vars( $q );
     1916        $query_vars = $this->fill_query_vars( $query_vars );
    19171917
    19181918        /**
     
    19281928        // Parse meta query.
    19291929        $this->meta_query = new WP_Meta_Query();
    1930         $this->meta_query->parse_query_vars( $q );
     1930        $this->meta_query->parse_query_vars( $query_vars );
    19311931
    19321932        // Set a flag if a 'pre_get_posts' hook changed the query vars.
     
    19501950        $page             = 1;
    19511951
    1952         if ( isset( $q['caller_get_posts'] ) ) {
     1952        if ( isset( $query_vars['caller_get_posts'] ) ) {
    19531953            _deprecated_argument(
    19541954                'WP_Query',
     
    19621962            );
    19631963
    1964             if ( ! isset( $q['ignore_sticky_posts'] ) ) {
    1965                 $q['ignore_sticky_posts'] = $q['caller_get_posts'];
    1966             }
    1967         }
    1968 
    1969         if ( ! isset( $q['ignore_sticky_posts'] ) ) {
    1970             $q['ignore_sticky_posts'] = false;
    1971         }
    1972 
    1973         if ( ! isset( $q['suppress_filters'] ) ) {
    1974             $q['suppress_filters'] = false;
    1975         }
    1976 
    1977         if ( ! isset( $q['cache_results'] ) ) {
    1978             $q['cache_results'] = true;
    1979         }
    1980 
    1981         if ( ! isset( $q['update_post_term_cache'] ) ) {
    1982             $q['update_post_term_cache'] = true;
    1983         }
    1984 
    1985         if ( ! isset( $q['update_menu_item_cache'] ) ) {
    1986             $q['update_menu_item_cache'] = false;
    1987         }
    1988 
    1989         if ( ! isset( $q['lazy_load_term_meta'] ) ) {
    1990             $q['lazy_load_term_meta'] = $q['update_post_term_cache'];
    1991         } elseif ( $q['lazy_load_term_meta'] ) { // Lazy loading term meta only works if term caches are primed.
    1992             $q['update_post_term_cache'] = true;
    1993         }
    1994 
    1995         if ( ! isset( $q['update_post_meta_cache'] ) ) {
    1996             $q['update_post_meta_cache'] = true;
    1997         }
    1998 
    1999         if ( ! isset( $q['post_type'] ) ) {
     1964            if ( ! isset( $query_vars['ignore_sticky_posts'] ) ) {
     1965                $query_vars['ignore_sticky_posts'] = $query_vars['caller_get_posts'];
     1966            }
     1967        }
     1968
     1969        if ( ! isset( $query_vars['ignore_sticky_posts'] ) ) {
     1970            $query_vars['ignore_sticky_posts'] = false;
     1971        }
     1972
     1973        if ( ! isset( $query_vars['suppress_filters'] ) ) {
     1974            $query_vars['suppress_filters'] = false;
     1975        }
     1976
     1977        if ( ! isset( $query_vars['cache_results'] ) ) {
     1978            $query_vars['cache_results'] = true;
     1979        }
     1980
     1981        if ( ! isset( $query_vars['update_post_term_cache'] ) ) {
     1982            $query_vars['update_post_term_cache'] = true;
     1983        }
     1984
     1985        if ( ! isset( $query_vars['update_menu_item_cache'] ) ) {
     1986            $query_vars['update_menu_item_cache'] = false;
     1987        }
     1988
     1989        if ( ! isset( $query_vars['lazy_load_term_meta'] ) ) {
     1990            $query_vars['lazy_load_term_meta'] = $query_vars['update_post_term_cache'];
     1991        } elseif ( $query_vars['lazy_load_term_meta'] ) { // Lazy loading term meta only works if term caches are primed.
     1992            $query_vars['update_post_term_cache'] = true;
     1993        }
     1994
     1995        if ( ! isset( $query_vars['update_post_meta_cache'] ) ) {
     1996            $query_vars['update_post_meta_cache'] = true;
     1997        }
     1998
     1999        if ( ! isset( $query_vars['post_type'] ) ) {
    20002000            if ( $this->is_search ) {
    2001                 $q['post_type'] = 'any';
     2001                $query_vars['post_type'] = 'any';
    20022002            } else {
    2003                 $q['post_type'] = '';
    2004             }
    2005         }
    2006         $post_type = $q['post_type'];
    2007         if ( empty( $q['posts_per_page'] ) ) {
    2008             $q['posts_per_page'] = get_option( 'posts_per_page' );
    2009         }
    2010         if ( isset( $q['showposts'] ) && $q['showposts'] ) {
    2011             $q['showposts']      = (int) $q['showposts'];
    2012             $q['posts_per_page'] = $q['showposts'];
    2013         }
    2014         if ( ( isset( $q['posts_per_archive_page'] ) && 0 != $q['posts_per_archive_page'] ) && ( $this->is_archive || $this->is_search ) ) {
    2015             $q['posts_per_page'] = $q['posts_per_archive_page'];
    2016         }
    2017         if ( ! isset( $q['nopaging'] ) ) {
    2018             if ( -1 == $q['posts_per_page'] ) {
    2019                 $q['nopaging'] = true;
     2003                $query_vars['post_type'] = '';
     2004            }
     2005        }
     2006        $post_type = $query_vars['post_type'];
     2007        if ( empty( $query_vars['posts_per_page'] ) ) {
     2008            $query_vars['posts_per_page'] = get_option( 'posts_per_page' );
     2009        }
     2010        if ( isset( $query_vars['showposts'] ) && $query_vars['showposts'] ) {
     2011            $query_vars['showposts']      = (int) $query_vars['showposts'];
     2012            $query_vars['posts_per_page'] = $query_vars['showposts'];
     2013        }
     2014        if ( ( isset( $query_vars['posts_per_archive_page'] ) && 0 != $query_vars['posts_per_archive_page'] ) && ( $this->is_archive || $this->is_search ) ) {
     2015            $query_vars['posts_per_page'] = $query_vars['posts_per_archive_page'];
     2016        }
     2017        if ( ! isset( $query_vars['nopaging'] ) ) {
     2018            if ( -1 == $query_vars['posts_per_page'] ) {
     2019                $query_vars['nopaging'] = true;
    20202020            } else {
    2021                 $q['nopaging'] = false;
     2021                $query_vars['nopaging'] = false;
    20222022            }
    20232023        }
     
    20252025        if ( $this->is_feed ) {
    20262026            // This overrides 'posts_per_page'.
    2027             if ( ! empty( $q['posts_per_rss'] ) ) {
    2028                 $q['posts_per_page'] = $q['posts_per_rss'];
     2027            if ( ! empty( $query_vars['posts_per_rss'] ) ) {
     2028                $query_vars['posts_per_page'] = $query_vars['posts_per_rss'];
    20292029            } else {
    2030                 $q['posts_per_page'] = get_option( 'posts_per_rss' );
    2031             }
    2032             $q['nopaging'] = false;
    2033         }
    2034 
    2035         $q['posts_per_page'] = (int) $q['posts_per_page'];
    2036         if ( $q['posts_per_page'] < -1 ) {
    2037             $q['posts_per_page'] = abs( $q['posts_per_page'] );
    2038         } elseif ( 0 === $q['posts_per_page'] ) {
    2039             $q['posts_per_page'] = 1;
    2040         }
    2041 
    2042         if ( ! isset( $q['comments_per_page'] ) || 0 == $q['comments_per_page'] ) {
    2043             $q['comments_per_page'] = get_option( 'comments_per_page' );
    2044         }
    2045 
    2046         if ( $this->is_home && ( empty( $this->query ) || 'true' === $q['preview'] ) && ( 'page' === get_option( 'show_on_front' ) ) && get_option( 'page_on_front' ) ) {
    2047             $this->is_page = true;
    2048             $this->is_home = false;
    2049             $q['page_id'] = get_option( 'page_on_front' );
    2050         }
    2051 
    2052         if ( isset( $q['page'] ) ) {
    2053             $q['page'] = is_scalar( $q['page'] ) ? absint( trim( $q['page'], '/' ) ) : 0;
     2030                $query_vars['posts_per_page'] = get_option( 'posts_per_rss' );
     2031            }
     2032            $query_vars['nopaging'] = false;
     2033        }
     2034
     2035        $query_vars['posts_per_page'] = (int) $query_vars['posts_per_page'];
     2036        if ( $query_vars['posts_per_page'] < -1 ) {
     2037            $query_vars['posts_per_page'] = abs( $query_vars['posts_per_page'] );
     2038        } elseif ( 0 === $query_vars['posts_per_page'] ) {
     2039            $query_vars['posts_per_page'] = 1;
     2040        }
     2041
     2042        if ( ! isset( $query_vars['comments_per_page'] ) || 0 == $query_vars['comments_per_page'] ) {
     2043            $query_vars['comments_per_page'] = get_option( 'comments_per_page' );
     2044        }
     2045
     2046        if ( $this->is_home && ( empty( $this->query ) || 'true' === $query_vars['preview'] ) && ( 'page' === get_option( 'show_on_front' ) ) && get_option( 'page_on_front' ) ) {
     2047            $this->is_page         = true;
     2048            $this->is_home         = false;
     2049            $query_vars['page_id'] = get_option( 'page_on_front' );
     2050        }
     2051
     2052        if ( isset( $query_vars['page'] ) ) {
     2053            $query_vars['page'] = is_scalar( $query_vars['page'] ) ? absint( trim( $query_vars['page'], '/' ) ) : 0;
    20542054        }
    20552055
    20562056        // If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
    2057         if ( isset( $q['no_found_rows'] ) ) {
    2058             $q['no_found_rows'] = (bool) $q['no_found_rows'];
     2057        if ( isset( $query_vars['no_found_rows'] ) ) {
     2058            $query_vars['no_found_rows'] = (bool) $query_vars['no_found_rows'];
    20592059        } else {
    2060             $q['no_found_rows'] = false;
    2061         }
    2062 
    2063         switch ( $q['fields'] ) {
     2060            $query_vars['no_found_rows'] = false;
     2061        }
     2062
     2063        switch ( $query_vars['fields'] ) {
    20642064            case 'ids':
    20652065                $fields = "{$wpdb->posts}.ID";
     
    20752075                 * entire post object has been queried.
    20762076                 */
    2077                 $q['fields'] = 'all';
     2077                $query_vars['fields'] = 'all';
    20782078                // Falls through.
    20792079            default:
     
    20812081        }
    20822082
    2083         if ( '' !== $q['menu_order'] ) {
    2084             $where .= " AND {$wpdb->posts}.menu_order = " . $q['menu_order'];
     2083        if ( '' !== $query_vars['menu_order'] ) {
     2084            $where .= " AND {$wpdb->posts}.menu_order = " . $query_vars['menu_order'];
    20852085        }
    20862086        // The "m" parameter is meant for months but accepts datetimes of varying specificity.
    2087         if ( $q['m'] ) {
    2088             $where .= " AND YEAR({$wpdb->posts}.post_date)=" . substr( $q['m'], 0, 4 );
    2089             if ( strlen( $q['m'] ) > 5 ) {
    2090                 $where .= " AND MONTH({$wpdb->posts}.post_date)=" . substr( $q['m'], 4, 2 );
    2091             }
    2092             if ( strlen( $q['m'] ) > 7 ) {
    2093                 $where .= " AND DAYOFMONTH({$wpdb->posts}.post_date)=" . substr( $q['m'], 6, 2 );
    2094             }
    2095             if ( strlen( $q['m'] ) > 9 ) {
    2096                 $where .= " AND HOUR({$wpdb->posts}.post_date)=" . substr( $q['m'], 8, 2 );
    2097             }
    2098             if ( strlen( $q['m'] ) > 11 ) {
    2099                 $where .= " AND MINUTE({$wpdb->posts}.post_date)=" . substr( $q['m'], 10, 2 );
    2100             }
    2101             if ( strlen( $q['m'] ) > 13 ) {
    2102                 $where .= " AND SECOND({$wpdb->posts}.post_date)=" . substr( $q['m'], 12, 2 );
     2087        if ( $query_vars['m'] ) {
     2088            $where .= " AND YEAR({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 0, 4 );
     2089            if ( strlen( $query_vars['m'] ) > 5 ) {
     2090                $where .= " AND MONTH({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 4, 2 );
     2091            }
     2092            if ( strlen( $query_vars['m'] ) > 7 ) {
     2093                $where .= " AND DAYOFMONTH({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 6, 2 );
     2094            }
     2095            if ( strlen( $query_vars['m'] ) > 9 ) {
     2096                $where .= " AND HOUR({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 8, 2 );
     2097            }
     2098            if ( strlen( $query_vars['m'] ) > 11 ) {
     2099                $where .= " AND MINUTE({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 10, 2 );
     2100            }
     2101            if ( strlen( $query_vars['m'] ) > 13 ) {
     2102                $where .= " AND SECOND({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 12, 2 );
    21032103            }
    21042104        }
     
    21072107        $date_parameters = array();
    21082108
    2109         if ( '' !== $q['hour'] ) {
    2110             $date_parameters['hour'] = $q['hour'];
    2111         }
    2112 
    2113         if ( '' !== $q['minute'] ) {
    2114             $date_parameters['minute'] = $q['minute'];
    2115         }
    2116 
    2117         if ( '' !== $q['second'] ) {
    2118             $date_parameters['second'] = $q['second'];
    2119         }
    2120 
    2121         if ( $q['year'] ) {
    2122             $date_parameters['year'] = $q['year'];
    2123         }
    2124 
    2125         if ( $q['monthnum'] ) {
    2126             $date_parameters['monthnum'] = $q['monthnum'];
    2127         }
    2128 
    2129         if ( $q['w'] ) {
    2130             $date_parameters['week'] = $q['w'];
    2131         }
    2132 
    2133         if ( $q['day'] ) {
    2134             $date_parameters['day'] = $q['day'];
     2109        if ( '' !== $query_vars['hour'] ) {
     2110            $date_parameters['hour'] = $query_vars['hour'];
     2111        }
     2112
     2113        if ( '' !== $query_vars['minute'] ) {
     2114            $date_parameters['minute'] = $query_vars['minute'];
     2115        }
     2116
     2117        if ( '' !== $query_vars['second'] ) {
     2118            $date_parameters['second'] = $query_vars['second'];
     2119        }
     2120
     2121        if ( $query_vars['year'] ) {
     2122            $date_parameters['year'] = $query_vars['year'];
     2123        }
     2124
     2125        if ( $query_vars['monthnum'] ) {
     2126            $date_parameters['monthnum'] = $query_vars['monthnum'];
     2127        }
     2128
     2129        if ( $query_vars['w'] ) {
     2130            $date_parameters['week'] = $query_vars['w'];
     2131        }
     2132
     2133        if ( $query_vars['day'] ) {
     2134            $date_parameters['day'] = $query_vars['day'];
    21352135        }
    21362136
     
    21422142
    21432143        // Handle complex date queries.
    2144         if ( ! empty( $q['date_query'] ) ) {
    2145             $this->date_query = new WP_Date_Query( $q['date_query'] );
     2144        if ( ! empty( $query_vars['date_query'] ) ) {
     2145            $this->date_query = new WP_Date_Query( $query_vars['date_query'] );
    21462146            $where           .= $this->date_query->get_sql();
    21472147        }
    21482148
    21492149        // If we've got a post_type AND it's not "any" post_type.
    2150         if ( ! empty( $q['post_type'] ) && 'any' !== $q['post_type'] ) {
    2151             foreach ( (array) $q['post_type'] as $_post_type ) {
     2150        if ( ! empty( $query_vars['post_type'] ) && 'any' !== $query_vars['post_type'] ) {
     2151            foreach ( (array) $query_vars['post_type'] as $_post_type ) {
    21522152                $ptype_obj = get_post_type_object( $_post_type );
    2153                 if ( ! $ptype_obj || ! $ptype_obj->query_var || empty( $q[ $ptype_obj->query_var ] ) ) {
     2153                if ( ! $ptype_obj || ! $ptype_obj->query_var || empty( $query_vars[ $ptype_obj->query_var ] ) ) {
    21542154                    continue;
    21552155                }
     
    21572157                if ( ! $ptype_obj->hierarchical ) {
    21582158                    // Non-hierarchical post types can directly use 'name'.
    2159                     $q['name'] = $q[ $ptype_obj->query_var ];
     2159                    $query_vars['name'] = $query_vars[ $ptype_obj->query_var ];
    21602160                } else {
    21612161                    // Hierarchical post types will operate through 'pagename'.
    2162                     $q['pagename'] = $q[ $ptype_obj->query_var ];
    2163                     $q['name']     = '';
     2162                    $query_vars['pagename'] = $query_vars[ $ptype_obj->query_var ];
     2163                    $query_vars['name']     = '';
    21642164                }
    21652165
     
    21702170        }
    21712171
    2172         if ( '' !== $q['title'] ) {
    2173             $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title = %s", stripslashes( $q['title'] ) );
     2172        if ( '' !== $query_vars['title'] ) {
     2173            $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title = %s", stripslashes( $query_vars['title'] ) );
    21742174        }
    21752175
    21762176        // Parameters related to 'post_name'.
    2177         if ( '' !== $q['name'] ) {
    2178             $q['name'] = sanitize_title_for_query( $q['name'] );
    2179             $where    .= " AND {$wpdb->posts}.post_name = '" . $q['name'] . "'";
    2180         } elseif ( '' !== $q['pagename'] ) {
     2177        if ( '' !== $query_vars['name'] ) {
     2178            $query_vars['name'] = sanitize_title_for_query( $query_vars['name'] );
     2179            $where             .= " AND {$wpdb->posts}.post_name = '" . $query_vars['name'] . "'";
     2180        } elseif ( '' !== $query_vars['pagename'] ) {
    21812181            if ( isset( $this->queried_object_id ) ) {
    21822182                $reqpage = $this->queried_object_id;
    21832183            } else {
    2184                 if ( 'page' !== $q['post_type'] ) {
    2185                     foreach ( (array) $q['post_type'] as $_post_type ) {
     2184                if ( 'page' !== $query_vars['post_type'] ) {
     2185                    foreach ( (array) $query_vars['post_type'] as $_post_type ) {
    21862186                        $ptype_obj = get_post_type_object( $_post_type );
    21872187                        if ( ! $ptype_obj || ! $ptype_obj->hierarchical ) {
     
    21892189                        }
    21902190
    2191                         $reqpage = get_page_by_path( $q['pagename'], OBJECT, $_post_type );
     2191                        $reqpage = get_page_by_path( $query_vars['pagename'], OBJECT, $_post_type );
    21922192                        if ( $reqpage ) {
    21932193                            break;
     
    21962196                    unset( $ptype_obj );
    21972197                } else {
    2198                     $reqpage = get_page_by_path( $q['pagename'] );
     2198                    $reqpage = get_page_by_path( $query_vars['pagename'] );
    21992199                }
    22002200                if ( ! empty( $reqpage ) ) {
     
    22072207            $page_for_posts = get_option( 'page_for_posts' );
    22082208            if ( ( 'page' !== get_option( 'show_on_front' ) ) || empty( $page_for_posts ) || ( $reqpage != $page_for_posts ) ) {
    2209                 $q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) );
    2210                 $q['name']     = $q['pagename'];
    2211                 $where        .= " AND ({$wpdb->posts}.ID = '$reqpage')";
    2212                 $reqpage_obj   = get_post( $reqpage );
     2209                $query_vars['pagename'] = sanitize_title_for_query( wp_basename( $query_vars['pagename'] ) );
     2210                $query_vars['name']     = $query_vars['pagename'];
     2211                $where                 .= " AND ({$wpdb->posts}.ID = '$reqpage')";
     2212                $reqpage_obj            = get_post( $reqpage );
    22132213                if ( is_object( $reqpage_obj ) && 'attachment' === $reqpage_obj->post_type ) {
    2214                     $this->is_attachment = true;
    2215                     $post_type           = 'attachment';
    2216                     $q['post_type']      = 'attachment';
    2217                     $this->is_page       = true;
    2218                     $q['attachment_id'] = $reqpage;
    2219                 }
    2220             }
    2221         } elseif ( '' !== $q['attachment'] ) {
    2222             $q['attachment'] = sanitize_title_for_query( wp_basename( $q['attachment'] ) );
    2223             $q['name']       = $q['attachment'];
    2224             $where          .= " AND {$wpdb->posts}.post_name = '" . $q['attachment'] . "'";
    2225         } elseif ( is_array( $q['post_name__in'] ) && ! empty( $q['post_name__in'] ) ) {
    2226             $q['post_name__in'] = array_map( 'sanitize_title_for_query', $q['post_name__in'] );
     2214                    $this->is_attachment         = true;
     2215                    $post_type                   = 'attachment';
     2216                    $query_vars['post_type']     = 'attachment';
     2217                    $this->is_page               = true;
     2218                    $query_vars['attachment_id'] = $reqpage;
     2219                }
     2220            }
     2221        } elseif ( '' !== $query_vars['attachment'] ) {
     2222            $query_vars['attachment'] = sanitize_title_for_query( wp_basename( $query_vars['attachment'] ) );
     2223            $query_vars['name']       = $query_vars['attachment'];
     2224            $where                   .= " AND {$wpdb->posts}.post_name = '" . $query_vars['attachment'] . "'";
     2225        } elseif ( is_array( $query_vars['post_name__in'] ) && ! empty( $query_vars['post_name__in'] ) ) {
     2226            $query_vars['post_name__in'] = array_map( 'sanitize_title_for_query', $query_vars['post_name__in'] );
    22272227            // Duplicate array before sorting to allow for the orderby clause.
    2228             $post_name__in_for_where = array_unique( $q['post_name__in'] );
     2228            $post_name__in_for_where = array_unique( $query_vars['post_name__in'] );
    22292229            sort( $post_name__in_for_where );
    22302230            $post_name__in = "'" . implode( "','", $post_name__in_for_where ) . "'";
     
    22332233
    22342234        // If an attachment is requested by number, let it supersede any post number.
    2235         if ( $q['attachment_id'] ) {
    2236             $q['p'] = absint( $q['attachment_id'] );
     2235        if ( $query_vars['attachment_id'] ) {
     2236            $query_vars['p'] = absint( $query_vars['attachment_id'] );
    22372237        }
    22382238
    22392239        // If a post number is specified, load that post.
    2240         if ( $q['p'] ) {
    2241             $where .= " AND {$wpdb->posts}.ID = " . $q['p'];
    2242         } elseif ( $q['post__in'] ) {
     2240        if ( $query_vars['p'] ) {
     2241            $where .= " AND {$wpdb->posts}.ID = " . $query_vars['p'];
     2242        } elseif ( $query_vars['post__in'] ) {
    22432243            // Duplicate array before sorting to allow for the orderby clause.
    2244             $post__in_for_where = $q['post__in'];
     2244            $post__in_for_where = $query_vars['post__in'];
    22452245            $post__in_for_where = array_unique( array_map( 'absint', $post__in_for_where ) );
    22462246            sort( $post__in_for_where );
    22472247            $post__in = implode( ',', array_map( 'absint', $post__in_for_where ) );
    22482248            $where   .= " AND {$wpdb->posts}.ID IN ($post__in)";
    2249         } elseif ( $q['post__not_in'] ) {
    2250             sort( $q['post__not_in'] );
    2251             $post__not_in = implode( ',', array_map( 'absint', $q['post__not_in'] ) );
     2249        } elseif ( $query_vars['post__not_in'] ) {
     2250            sort( $query_vars['post__not_in'] );
     2251            $post__not_in = implode( ',', array_map( 'absint', $query_vars['post__not_in'] ) );
    22522252            $where       .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
    22532253        }
    22542254
    2255         if ( is_numeric( $q['post_parent'] ) ) {
    2256             $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_parent = %d ", $q['post_parent'] );
    2257         } elseif ( $q['post_parent__in'] ) {
     2255        if ( is_numeric( $query_vars['post_parent'] ) ) {
     2256            $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_parent = %d ", $query_vars['post_parent'] );
     2257        } elseif ( $query_vars['post_parent__in'] ) {
    22582258            // Duplicate array before sorting to allow for the orderby clause.
    2259             $post_parent__in_for_where = $q['post_parent__in'];
     2259            $post_parent__in_for_where = $query_vars['post_parent__in'];
    22602260            $post_parent__in_for_where = array_unique( array_map( 'absint', $post_parent__in_for_where ) );
    22612261            sort( $post_parent__in_for_where );
    22622262            $post_parent__in = implode( ',', array_map( 'absint', $post_parent__in_for_where ) );
    22632263            $where          .= " AND {$wpdb->posts}.post_parent IN ($post_parent__in)";
    2264         } elseif ( $q['post_parent__not_in'] ) {
    2265             sort( $q['post_parent__not_in'] );
    2266             $post_parent__not_in = implode( ',', array_map( 'absint', $q['post_parent__not_in'] ) );
     2264        } elseif ( $query_vars['post_parent__not_in'] ) {
     2265            sort( $query_vars['post_parent__not_in'] );
     2266            $post_parent__not_in = implode( ',', array_map( 'absint', $query_vars['post_parent__not_in'] ) );
    22672267            $where              .= " AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)";
    22682268        }
    22692269
    2270         if ( $q['page_id'] ) {
    2271             if ( ( 'page' !== get_option( 'show_on_front' ) ) || ( get_option( 'page_for_posts' ) != $q['page_id'] ) ) {
    2272                 $q['p'] = $q['page_id'];
    2273                 $where  = " AND {$wpdb->posts}.ID = " . $q['page_id'];
     2270        if ( $query_vars['page_id'] ) {
     2271            if ( ( 'page' !== get_option( 'show_on_front' ) ) || ( get_option( 'page_for_posts' ) != $query_vars['page_id'] ) ) {
     2272                $query_vars['p'] = $query_vars['page_id'];
     2273                $where           = " AND {$wpdb->posts}.ID = " . $query_vars['page_id'];
    22742274            }
    22752275        }
    22762276
    22772277        // If a search pattern is specified, load the posts that match.
    2278         if ( strlen( $q['s'] ) ) {
    2279             $search = $this->parse_search( $q );
    2280         }
    2281 
    2282         if ( ! $q['suppress_filters'] ) {
     2278        if ( strlen( $query_vars['s'] ) ) {
     2279            $search = $this->parse_search( $query_vars );
     2280        }
     2281
     2282        if ( ! $query_vars['suppress_filters'] ) {
    22832283            /**
    22842284             * Filters the search SQL that is used in the WHERE clause of WP_Query.
     
    22942294        // Taxonomies.
    22952295        if ( ! $this->is_singular ) {
    2296             $this->parse_tax_query( $q );
     2296            $this->parse_tax_query( $query_vars );
    22972297
    22982298            $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
     
    23382338             * first taxonomy other than 'post_tag' or 'category'.
    23392339             */
    2340             if ( ! isset( $q['taxonomy'] ) ) {
     2340            if ( ! isset( $query_vars['taxonomy'] ) ) {
    23412341                foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
    23422342                    if ( empty( $queried_items['terms'][0] ) ) {
     
    23452345
    23462346                    if ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ), true ) ) {
    2347                         $q['taxonomy'] = $queried_taxonomy;
     2347                        $query_vars['taxonomy'] = $queried_taxonomy;
    23482348
    23492349                        if ( 'slug' === $queried_items['field'] ) {
    2350                             $q['term'] = $queried_items['terms'][0];
     2350                            $query_vars['term'] = $queried_items['terms'][0];
    23512351                        } else {
    2352                             $q['term_id'] = $queried_items['terms'][0];
     2352                            $query_vars['term_id'] = $queried_items['terms'][0];
    23532353                        }
    23542354
     
    23902390        // Author/user stuff.
    23912391
    2392         if ( ! empty( $q['author'] ) && '0' != $q['author'] ) {
    2393             $q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );
    2394             $authors     = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) );
     2392        if ( ! empty( $query_vars['author'] ) && '0' != $query_vars['author'] ) {
     2393            $query_vars['author'] = addslashes_gpc( '' . urldecode( $query_vars['author'] ) );
     2394            $authors              = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $query_vars['author'] ) ) );
    23952395            sort( $authors );
    23962396            foreach ( $authors as $author ) {
    2397                 $key         = $author > 0 ? 'author__in' : 'author__not_in';
    2398                 $q[ $key ][] = abs( $author );
    2399             }
    2400             $q['author'] = implode( ',', $authors );
    2401         }
    2402 
    2403         if ( ! empty( $q['author__not_in'] ) ) {
    2404             if ( is_array( $q['author__not_in'] ) ) {
    2405                 $q['author__not_in'] = array_unique( array_map( 'absint', $q['author__not_in'] ) );
    2406                 sort( $q['author__not_in'] );
    2407             }
    2408             $author__not_in = implode( ',', (array) $q['author__not_in'] );
     2397                $key                  = $author > 0 ? 'author__in' : 'author__not_in';
     2398                $query_vars[ $key ][] = abs( $author );
     2399            }
     2400            $query_vars['author'] = implode( ',', $authors );
     2401        }
     2402
     2403        if ( ! empty( $query_vars['author__not_in'] ) ) {
     2404            if ( is_array( $query_vars['author__not_in'] ) ) {
     2405                $query_vars['author__not_in'] = array_unique( array_map( 'absint', $query_vars['author__not_in'] ) );
     2406                sort( $query_vars['author__not_in'] );
     2407            }
     2408            $author__not_in = implode( ',', (array) $query_vars['author__not_in'] );
    24092409            $where         .= " AND {$wpdb->posts}.post_author NOT IN ($author__not_in) ";
    2410         } elseif ( ! empty( $q['author__in'] ) ) {
    2411             if ( is_array( $q['author__in'] ) ) {
    2412                 $q['author__in'] = array_unique( array_map( 'absint', $q['author__in'] ) );
    2413                 sort( $q['author__in'] );
    2414             }
    2415             $author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) );
     2410        } elseif ( ! empty( $query_vars['author__in'] ) ) {
     2411            if ( is_array( $query_vars['author__in'] ) ) {
     2412                $query_vars['author__in'] = array_unique( array_map( 'absint', $query_vars['author__in'] ) );
     2413                sort( $query_vars['author__in'] );
     2414            }
     2415            $author__in = implode( ',', array_map( 'absint', array_unique( (array) $query_vars['author__in'] ) ) );
    24162416            $where     .= " AND {$wpdb->posts}.post_author IN ($author__in) ";
    24172417        }
     
    24192419        // Author stuff for nice URLs.
    24202420
    2421         if ( '' !== $q['author_name'] ) {
    2422             if ( str_contains( $q['author_name'], '/' ) ) {
    2423                 $q['author_name'] = explode( '/', $q['author_name'] );
    2424                 if ( $q['author_name'][ count( $q['author_name'] ) - 1 ] ) {
    2425                     $q['author_name'] = $q['author_name'][ count( $q['author_name'] ) - 1 ]; // No trailing slash.
     2421        if ( '' !== $query_vars['author_name'] ) {
     2422            if ( str_contains( $query_vars['author_name'], '/' ) ) {
     2423                $query_vars['author_name'] = explode( '/', $query_vars['author_name'] );
     2424                if ( $query_vars['author_name'][ count( $query_vars['author_name'] ) - 1 ] ) {
     2425                    $query_vars['author_name'] = $query_vars['author_name'][ count( $query_vars['author_name'] ) - 1 ]; // No trailing slash.
    24262426                } else {
    2427                     $q['author_name'] = $q['author_name'][ count( $q['author_name'] ) - 2 ]; // There was a trailing slash.
    2428                 }
    2429             }
    2430             $q['author_name'] = sanitize_title_for_query( $q['author_name'] );
    2431             $q['author']      = get_user_by( 'slug', $q['author_name'] );
    2432             if ( $q['author'] ) {
    2433                 $q['author'] = $q['author']->ID;
    2434             }
    2435             $whichauthor .= " AND ({$wpdb->posts}.post_author = " . absint( $q['author'] ) . ')';
     2427                    $query_vars['author_name'] = $query_vars['author_name'][ count( $query_vars['author_name'] ) - 2 ]; // There was a trailing slash.
     2428                }
     2429            }
     2430            $query_vars['author_name'] = sanitize_title_for_query( $query_vars['author_name'] );
     2431            $query_vars['author']      = get_user_by( 'slug', $query_vars['author_name'] );
     2432            if ( $query_vars['author'] ) {
     2433                $query_vars['author'] = $query_vars['author']->ID;
     2434            }
     2435            $whichauthor .= " AND ({$wpdb->posts}.post_author = " . absint( $query_vars['author'] ) . ')';
    24362436        }
    24372437
    24382438        // Matching by comment count.
    2439         if ( isset( $q['comment_count'] ) ) {
     2439        if ( isset( $query_vars['comment_count'] ) ) {
    24402440            // Numeric comment count is converted to array format.
    2441             if ( is_numeric( $q['comment_count'] ) ) {
    2442                 $q['comment_count'] = array(
    2443                     'value' => (int) $q['comment_count'],
     2441            if ( is_numeric( $query_vars['comment_count'] ) ) {
     2442                $query_vars['comment_count'] = array(
     2443                    'value' => (int) $query_vars['comment_count'],
    24442444                );
    24452445            }
    24462446
    2447             if ( isset( $q['comment_count']['value'] ) ) {
    2448                 $q['comment_count'] = array_merge(
     2447            if ( isset( $query_vars['comment_count']['value'] ) ) {
     2448                $query_vars['comment_count'] = array_merge(
    24492449                    array(
    24502450                        'compare' => '=',
    24512451                    ),
    2452                     $q['comment_count']
     2452                    $query_vars['comment_count']
    24532453                );
    24542454
    24552455                // Fallback for invalid compare operators is '='.
    24562456                $compare_operators = array( '=', '!=', '>', '>=', '<', '<=' );
    2457                 if ( ! in_array( $q['comment_count']['compare'], $compare_operators, true ) ) {
    2458                     $q['comment_count']['compare'] = '=';
    2459                 }
    2460 
    2461                 $where .= $wpdb->prepare( " AND {$wpdb->posts}.comment_count {$q['comment_count']['compare']} %d", $q['comment_count']['value'] );
     2457                if ( ! in_array( $query_vars['comment_count']['compare'], $compare_operators, true ) ) {
     2458                    $query_vars['comment_count']['compare'] = '=';
     2459                }
     2460
     2461                $where .= $wpdb->prepare( " AND {$wpdb->posts}.comment_count {$query_vars['comment_count']['compare']} %d", $query_vars['comment_count']['value'] );
    24622462            }
    24632463        }
     
    24652465        // MIME-Type stuff for attachment browsing.
    24662466
    2467         if ( isset( $q['post_mime_type'] ) && '' !== $q['post_mime_type'] ) {
    2468             $whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
     2467        if ( isset( $query_vars['post_mime_type'] ) && '' !== $query_vars['post_mime_type'] ) {
     2468            $whichmimetype = wp_post_mime_type_where( $query_vars['post_mime_type'], $wpdb->posts );
    24692469        }
    24702470        $where .= $search . $whichauthor . $whichmimetype;
     
    24802480        }
    24812481
    2482         $rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] );
    2483         if ( ! isset( $q['order'] ) ) {
    2484             $q['order'] = $rand ? '' : 'DESC';
     2482        $rand = ( isset( $query_vars['orderby'] ) && 'rand' === $query_vars['orderby'] );
     2483        if ( ! isset( $query_vars['order'] ) ) {
     2484            $query_vars['order'] = $rand ? '' : 'DESC';
    24852485        } else {
    2486             $q['order'] = $rand ? '' : $this->parse_order( $q['order'] );
     2486            $query_vars['order'] = $rand ? '' : $this->parse_order( $query_vars['order'] );
    24872487        }
    24882488
    24892489        // These values of orderby should ignore the 'order' parameter.
    24902490        $force_asc = array( 'post__in', 'post_name__in', 'post_parent__in' );
    2491         if ( isset( $q['orderby'] ) && in_array( $q['orderby'], $force_asc, true ) ) {
    2492             $q['order'] = '';
     2491        if ( isset( $query_vars['orderby'] ) && in_array( $query_vars['orderby'], $force_asc, true ) ) {
     2492            $query_vars['order'] = '';
    24932493        }
    24942494
    24952495        // Order by.
    2496         if ( empty( $q['orderby'] ) ) {
     2496        if ( empty( $query_vars['orderby'] ) ) {
    24972497            /*
    24982498             * Boolean false or empty array blanks out ORDER BY,
    24992499             * while leaving the value unset or otherwise empty sets the default.
    25002500             */
    2501             if ( isset( $q['orderby'] ) && ( is_array( $q['orderby'] ) || false === $q['orderby'] ) ) {
     2501            if ( isset( $query_vars['orderby'] ) && ( is_array( $query_vars['orderby'] ) || false === $query_vars['orderby'] ) ) {
    25022502                $orderby = '';
    25032503            } else {
    2504                 $orderby = "{$wpdb->posts}.post_date " . $q['order'];
    2505             }
    2506         } elseif ( 'none' === $q['orderby'] ) {
     2504                $orderby = "{$wpdb->posts}.post_date " . $query_vars['order'];
     2505            }
     2506        } elseif ( 'none' === $query_vars['orderby'] ) {
    25072507            $orderby = '';
    25082508        } else {
    25092509            $orderby_array = array();
    2510             if ( is_array( $q['orderby'] ) ) {
    2511                 foreach ( $q['orderby'] as $_orderby => $order ) {
     2510            if ( is_array( $query_vars['orderby'] ) ) {
     2511                foreach ( $query_vars['orderby'] as $_orderby => $order ) {
    25122512                    $orderby = addslashes_gpc( urldecode( $_orderby ) );
    25132513                    $parsed  = $this->parse_orderby( $orderby );
     
    25222522
    25232523            } else {
    2524                 $q['orderby'] = urldecode( $q['orderby'] );
    2525                 $q['orderby'] = addslashes_gpc( $q['orderby'] );
    2526 
    2527                 foreach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) {
     2524                $query_vars['orderby'] = urldecode( $query_vars['orderby'] );
     2525                $query_vars['orderby'] = addslashes_gpc( $query_vars['orderby'] );
     2526
     2527                foreach ( explode( ' ', $query_vars['orderby'] ) as $i => $orderby ) {
    25282528                    $parsed = $this->parse_orderby( $orderby );
    25292529                    // Only allow certain values for safety.
     
    25342534                    $orderby_array[] = $parsed;
    25352535                }
    2536                 $orderby = implode( ' ' . $q['order'] . ', ', $orderby_array );
     2536                $orderby = implode( ' ' . $query_vars['order'] . ', ', $orderby_array );
    25372537
    25382538                if ( empty( $orderby ) ) {
    2539                     $orderby = "{$wpdb->posts}.post_date " . $q['order'];
    2540                 } elseif ( ! empty( $q['order'] ) ) {
    2541                     $orderby .= " {$q['order']}";
     2539                    $orderby = "{$wpdb->posts}.post_date " . $query_vars['order'];
     2540                } elseif ( ! empty( $query_vars['order'] ) ) {
     2541                    $orderby .= " {$query_vars['order']}";
    25422542                }
    25432543            }
     
    25452545
    25462546        // Order search results by relevance only when another "orderby" is not specified in the query.
    2547         if ( ! empty( $q['s'] ) ) {
     2547        if ( ! empty( $query_vars['s'] ) ) {
    25482548            $search_orderby = '';
    2549             if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) ) {
    2550                 $search_orderby = $this->parse_search_order( $q );
    2551             }
    2552 
    2553             if ( ! $q['suppress_filters'] ) {
     2549            if ( ! empty( $query_vars['search_orderby_title'] ) && ( empty( $query_vars['orderby'] ) && ! $this->is_feed ) || ( isset( $query_vars['orderby'] ) && 'relevance' === $query_vars['orderby'] ) ) {
     2550                $search_orderby = $this->parse_search_order( $query_vars );
     2551            }
     2552
     2553            if ( ! $query_vars['suppress_filters'] ) {
    25542554                /**
    25552555                 * Filters the ORDER BY used when ordering search results.
     
    25802580        }
    25812581
    2582         if ( isset( $q['post_password'] ) ) {
    2583             $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_password = %s", $q['post_password'] );
    2584             if ( empty( $q['perm'] ) ) {
    2585                 $q['perm'] = 'readable';
    2586             }
    2587         } elseif ( isset( $q['has_password'] ) ) {
    2588             $where .= sprintf( " AND {$wpdb->posts}.post_password %s ''", $q['has_password'] ? '!=' : '=' );
    2589         }
    2590 
    2591         if ( ! empty( $q['comment_status'] ) ) {
    2592             $where .= $wpdb->prepare( " AND {$wpdb->posts}.comment_status = %s ", $q['comment_status'] );
    2593         }
    2594 
    2595         if ( ! empty( $q['ping_status'] ) ) {
    2596             $where .= $wpdb->prepare( " AND {$wpdb->posts}.ping_status = %s ", $q['ping_status'] );
     2582        if ( isset( $query_vars['post_password'] ) ) {
     2583            $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_password = %s", $query_vars['post_password'] );
     2584            if ( empty( $query_vars['perm'] ) ) {
     2585                $query_vars['perm'] = 'readable';
     2586            }
     2587        } elseif ( isset( $query_vars['has_password'] ) ) {
     2588            $where .= sprintf( " AND {$wpdb->posts}.post_password %s ''", $query_vars['has_password'] ? '!=' : '=' );
     2589        }
     2590
     2591        if ( ! empty( $query_vars['comment_status'] ) ) {
     2592            $where .= $wpdb->prepare( " AND {$wpdb->posts}.comment_status = %s ", $query_vars['comment_status'] );
     2593        }
     2594
     2595        if ( ! empty( $query_vars['ping_status'] ) ) {
     2596            $where .= $wpdb->prepare( " AND {$wpdb->posts}.ping_status = %s ", $query_vars['ping_status'] );
    25972597        }
    25982598
     
    26402640        if ( $skip_post_status ) {
    26412641            $where .= $post_type_where;
    2642         } elseif ( ! empty( $q['post_status'] ) ) {
     2642        } elseif ( ! empty( $query_vars['post_status'] ) ) {
    26432643
    26442644            $where .= $post_type_where;
    26452645
    26462646            $statuswheres = array();
    2647             $q_status     = $q['post_status'];
     2647            $q_status     = $query_vars['post_status'];
    26482648            if ( ! is_array( $q_status ) ) {
    26492649                $q_status = explode( ',', $q_status );
     
    26712671            }
    26722672
    2673             if ( empty( $q['perm'] ) || 'readable' !== $q['perm'] ) {
     2673            if ( empty( $query_vars['perm'] ) || 'readable' !== $query_vars['perm'] ) {
    26742674                $r_status = array_merge( $r_status, $p_status );
    26752675                unset( $p_status );
     
    26802680            }
    26812681            if ( ! empty( $r_status ) ) {
    2682                 if ( ! empty( $q['perm'] ) && 'editable' === $q['perm'] && ! current_user_can( $edit_others_cap ) ) {
     2682                if ( ! empty( $query_vars['perm'] ) && 'editable' === $query_vars['perm'] && ! current_user_can( $edit_others_cap ) ) {
    26832683                    $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $r_status ) . '))';
    26842684                } else {
     
    26872687            }
    26882688            if ( ! empty( $p_status ) ) {
    2689                 if ( ! empty( $q['perm'] ) && 'readable' === $q['perm'] && ! current_user_can( $read_private_cap ) ) {
     2689                if ( ! empty( $query_vars['perm'] ) && 'readable' === $query_vars['perm'] && ! current_user_can( $read_private_cap ) ) {
    26902690                    $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $p_status ) . '))';
    26912691                } else {
     
    27732773         * manipulations to them are reflected in the paging by day queries.
    27742774         */
    2775         if ( ! $q['suppress_filters'] ) {
     2775        if ( ! $query_vars['suppress_filters'] ) {
    27762776            /**
    27772777             * Filters the WHERE clause of the query.
     
    27962796
    27972797        // Paging.
    2798         if ( empty( $q['nopaging'] ) && ! $this->is_singular ) {
    2799             $page = absint( $q['paged'] );
     2798        if ( empty( $query_vars['nopaging'] ) && ! $this->is_singular ) {
     2799            $page = absint( $query_vars['paged'] );
    28002800            if ( ! $page ) {
    28012801                $page = 1;
     
    28032803
    28042804            // If 'offset' is provided, it takes precedence over 'paged'.
    2805             if ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {
    2806                 $q['offset'] = absint( $q['offset'] );
    2807                 $pgstrt      = $q['offset'] . ', ';
     2805            if ( isset( $query_vars['offset'] ) && is_numeric( $query_vars['offset'] ) ) {
     2806                $query_vars['offset'] = absint( $query_vars['offset'] );
     2807                $pgstrt               = $query_vars['offset'] . ', ';
    28082808            } else {
    2809                 $pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
    2810             }
    2811             $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
     2809                $pgstrt = absint( ( $page - 1 ) * $query_vars['posts_per_page'] ) . ', ';
     2810            }
     2811            $limits = 'LIMIT ' . $pgstrt . $query_vars['posts_per_page'];
    28122812        }
    28132813
     
    28242824            }
    28252825
    2826             if ( ! $q['suppress_filters'] ) {
     2826            if ( ! $query_vars['suppress_filters'] ) {
    28272827                /**
    28282828                 * Filters the JOIN clause of the comments feed query before sending.
     
    29222922         * manipulate paging queries should use these hooks.
    29232923         */
    2924         if ( ! $q['suppress_filters'] ) {
     2924        if ( ! $query_vars['suppress_filters'] ) {
    29252925            /**
    29262926             * Filters the WHERE clause of the query.
     
    30443044         * Regular plugins should use the hooks above.
    30453045         */
    3046         if ( ! $q['suppress_filters'] ) {
     3046        if ( ! $query_vars['suppress_filters'] ) {
    30473047            /**
    30483048             * Filters the WHERE clause of the query.
     
    31713171
    31723172        $found_rows = '';
    3173         if ( ! $q['no_found_rows'] && ! empty( $limits ) ) {
     3173        if ( ! $query_vars['no_found_rows'] && ! empty( $limits ) ) {
    31743174            $found_rows = 'SQL_CALC_FOUND_ROWS';
    31753175        }
     
    31963196        $this->request = $old_request;
    31973197
    3198         if ( ! $q['suppress_filters'] ) {
     3198        if ( ! $query_vars['suppress_filters'] ) {
    31993199            /**
    32003200             * Filters the completed SQL query before sending.
     
    32553255        }
    32563256
    3257         if ( $q['cache_results'] && $id_query_is_cacheable ) {
     3257        if ( $query_vars['cache_results'] && $id_query_is_cacheable ) {
    32583258            $new_request = str_replace( $fields, "{$wpdb->posts}.*", $this->request );
    3259             $cache_key   = $this->generate_cache_key( $q, $new_request );
     3259            $cache_key   = $this->generate_cache_key( $query_vars, $new_request );
    32603260
    32613261            $cache_found = false;
     
    32723272                    $this->max_num_pages = $cached_results['max_num_pages'];
    32733273
    3274                     if ( 'ids' === $q['fields'] ) {
     3274                    if ( 'ids' === $query_vars['fields'] ) {
    32753275                        $this->posts = $post_ids;
    32763276
    32773277                        return $this->posts;
    3278                     } elseif ( 'id=>parent' === $q['fields'] ) {
     3278                    } elseif ( 'id=>parent' === $query_vars['fields'] ) {
    32793279                        _prime_post_parent_id_caches( $post_ids );
    32803280
     
    32973297                        return $post_parents;
    32983298                    } else {
    3299                         _prime_post_caches( $post_ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
     3299                        _prime_post_caches( $post_ids, $query_vars['update_post_term_cache'], $query_vars['update_post_meta_cache'] );
    33003300                        /** @var WP_Post[] */
    33013301                        $this->posts = array_map( 'get_post', $post_ids );
     
    33053305        }
    33063306
    3307         if ( 'ids' === $q['fields'] ) {
     3307        if ( 'ids' === $query_vars['fields'] ) {
    33083308            if ( null === $this->posts ) {
    33093309                $this->posts = $wpdb->get_col( $this->request );
     
    33133313            $this->posts      = array_map( 'intval', $this->posts );
    33143314            $this->post_count = count( $this->posts );
    3315             $this->set_found_posts( $q, $limits );
    3316 
    3317             if ( $q['cache_results'] && $id_query_is_cacheable ) {
     3315            $this->set_found_posts( $query_vars, $limits );
     3316
     3317            if ( $query_vars['cache_results'] && $id_query_is_cacheable ) {
    33183318                $cache_value = array(
    33193319                    'posts'         => $this->posts,
     
    33283328        }
    33293329
    3330         if ( 'id=>parent' === $q['fields'] ) {
     3330        if ( 'id=>parent' === $query_vars['fields'] ) {
    33313331            if ( null === $this->posts ) {
    33323332                $this->posts = $wpdb->get_results( $this->request );
     
    33343334
    33353335            $this->post_count = count( $this->posts );
    3336             $this->set_found_posts( $q, $limits );
     3336            $this->set_found_posts( $query_vars, $limits );
    33373337
    33383338            /** @var int[] */
     
    33533353            wp_cache_add_multiple( $post_parents_cache, 'posts' );
    33543354
    3355             if ( $q['cache_results'] && $id_query_is_cacheable ) {
     3355            if ( $query_vars['cache_results'] && $id_query_is_cacheable ) {
    33563356                $cache_value = array(
    33573357                    'posts'         => $post_ids,
     
    33733373                && (
    33743374                    wp_using_ext_object_cache()
    3375                     || ( ! empty( $limits ) && $q['posts_per_page'] < 500 )
     3375                    || ( ! empty( $limits ) && $query_vars['posts_per_page'] < 500 )
    33763376                )
    33773377            );
     
    34303430                if ( $post_ids ) {
    34313431                    $this->posts = $post_ids;
    3432                     $this->set_found_posts( $q, $limits );
    3433                     _prime_post_caches( $post_ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
     3432                    $this->set_found_posts( $query_vars, $limits );
     3433                    _prime_post_caches( $post_ids, $query_vars['update_post_term_cache'], $query_vars['update_post_meta_cache'] );
    34343434                } else {
    34353435                    $this->posts = array();
     
    34373437            } else {
    34383438                $this->posts = $wpdb->get_results( $this->request );
    3439                 $this->set_found_posts( $q, $limits );
     3439                $this->set_found_posts( $query_vars, $limits );
    34403440            }
    34413441        }
     
    34493449        $unfiltered_posts = $this->posts;
    34503450
    3451         if ( $q['cache_results'] && $id_query_is_cacheable && ! $cache_found ) {
     3451        if ( $query_vars['cache_results'] && $id_query_is_cacheable && ! $cache_found ) {
    34523452            $post_ids = wp_list_pluck( $this->posts, 'ID' );
    34533453
     
    34613461        }
    34623462
    3463         if ( ! $q['suppress_filters'] ) {
     3463        if ( ! $query_vars['suppress_filters'] ) {
    34643464            /**
    34653465             * Filters the raw post results array, prior to status checks.
     
    35703570        // Put sticky posts at the top of the posts array.
    35713571        $sticky_posts = get_option( 'sticky_posts' );
    3572         if ( $this->is_home && $page <= 1 && is_array( $sticky_posts ) && ! empty( $sticky_posts ) && ! $q['ignore_sticky_posts'] ) {
     3572        if ( $this->is_home && $page <= 1 && is_array( $sticky_posts ) && ! empty( $sticky_posts ) && ! $query_vars['ignore_sticky_posts'] ) {
    35733573            $num_posts     = count( $this->posts );
    35743574            $sticky_offset = 0;
     
    35903590
    35913591            // If any posts have been excluded specifically, Ignore those that are sticky.
    3592             if ( ! empty( $sticky_posts ) && ! empty( $q['post__not_in'] ) ) {
    3593                 $sticky_posts = array_diff( $sticky_posts, $q['post__not_in'] );
     3592            if ( ! empty( $sticky_posts ) && ! empty( $query_vars['post__not_in'] ) ) {
     3593                $sticky_posts = array_diff( $sticky_posts, $query_vars['post__not_in'] );
    35943594            }
    35953595
     
    36023602                        'post_status'            => 'publish',
    36033603                        'posts_per_page'         => count( $sticky_posts ),
    3604                         'suppress_filters'       => $q['suppress_filters'],
    3605                         'cache_results'          => $q['cache_results'],
    3606                         'update_post_meta_cache' => $q['update_post_meta_cache'],
    3607                         'update_post_term_cache' => $q['update_post_term_cache'],
    3608                         'lazy_load_term_meta'    => $q['lazy_load_term_meta'],
     3604                        'suppress_filters'       => $query_vars['suppress_filters'],
     3605                        'cache_results'          => $query_vars['cache_results'],
     3606                        'update_post_meta_cache' => $query_vars['update_post_meta_cache'],
     3607                        'update_post_term_cache' => $query_vars['update_post_term_cache'],
     3608                        'lazy_load_term_meta'    => $query_vars['lazy_load_term_meta'],
    36093609                    )
    36103610                );
     
    36173617        }
    36183618
    3619         if ( ! $q['suppress_filters'] ) {
     3619        if ( ! $query_vars['suppress_filters'] ) {
    36203620            /**
    36213621             * Filters the array of retrieved posts after they've been fetched and
     
    36403640            $this->posts = array_map( 'get_post', $this->posts );
    36413641
    3642             if ( $q['cache_results'] ) {
     3642            if ( $query_vars['cache_results'] ) {
    36433643                if ( $is_unfiltered_query && $unfiltered_posts === $this->posts ) {
    3644                     update_post_caches( $this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
     3644                    update_post_caches( $this->posts, $post_type, $query_vars['update_post_term_cache'], $query_vars['update_post_meta_cache'] );
    36453645                } else {
    36463646                    $post_ids = wp_list_pluck( $this->posts, 'ID' );
    3647                     _prime_post_caches( $post_ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
     3647                    _prime_post_caches( $post_ids, $query_vars['update_post_term_cache'], $query_vars['update_post_meta_cache'] );
    36483648                }
    36493649            }
     
    36563656        }
    36573657
    3658         if ( ! empty( $this->posts ) && $q['update_menu_item_cache'] ) {
     3658        if ( ! empty( $this->posts ) && $query_vars['update_menu_item_cache'] ) {
    36593659            update_menu_item_cache( $this->posts );
    36603660        }
    36613661
    3662         if ( $q['lazy_load_term_meta'] ) {
     3662        if ( $query_vars['lazy_load_term_meta'] ) {
    36633663            wp_queue_posts_for_term_meta_lazyload( $this->posts );
    36643664        }
     
    36753675     * @global wpdb $wpdb WordPress database abstraction object.
    36763676     *
    3677      * @param array  $q      Query variables.
    3678      * @param string $limits LIMIT clauses of the query.
    3679      */
    3680     private function set_found_posts( $q, $limits ) {
     3677     * @param array  $query_vars Query variables.
     3678     * @param string $limits     LIMIT clauses of the query.
     3679     */
     3680    private function set_found_posts( $query_vars, $limits ) {
    36813681        global $wpdb;
    36823682
     
    36853685         * null, or false to accommodate caching plugins that fill posts later.
    36863686         */
    3687         if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) {
     3687        if ( $query_vars['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) {
    36883688            return;
    36893689        }
     
    37243724
    37253725        if ( ! empty( $limits ) ) {
    3726             $this->max_num_pages = (int) ceil( $this->found_posts / $q['posts_per_page'] );
     3726            $this->max_num_pages = (int) ceil( $this->found_posts / $query_vars['posts_per_page'] );
    37273727        }
    37283728    }
     
    44444444        }
    44454445
    4446         $qv = $this->get( 'feed' );
    4447         if ( 'feed' === $qv ) {
    4448             $qv = get_default_feed();
    4449         }
    4450 
    4451         return in_array( $qv, (array) $feeds, true );
     4446        $query_var = $this->get( 'feed' );
     4447        if ( 'feed' === $query_var ) {
     4448            $query_var = get_default_feed();
     4449        }
     4450
     4451        return in_array( $query_var, (array) $feeds, true );
    44524452    }
    44534453
Note: See TracChangeset for help on using the changeset viewer.