Ticket #16622: 16622.2.diff

File 16622.2.diff, 1.8 KB (added by SergeyBiryukov, 2 years ago)
  • wp-includes/query.php

     
    12311231        var $is_post_type_archive = false; 
    12321232 
    12331233        /** 
    1234          * Whether the tax query has been parsed once. 
     1234         * Stores the ->query_vars state like md5( serialize( $this->query_vars ) ) so we know 
     1235         * whether we have to re-parse because something has changed. 
    12351236         * 
    12361237         * @since 3.1.0 
    12371238         * @access private 
    1238          * @var bool 
    12391239         */ 
    1240         var $parsed_tax_query = false; 
     1240        var $query_vars_hash = false; 
    12411241 
    12421242        /** 
    12431243         * Resets query flags to false. 
     
    14961496                                $this->is_date = true; 
    14971497                        } 
    14981498 
    1499                         $this->parsed_tax_query = false; 
     1499                        $this->query_vars_hash = false; 
    15001500                        $this->parse_tax_query( $qv ); 
    15011501 
    15021502                        foreach ( $this->tax_query->queries as $tax_query ) { 
     
    16811681                        } 
    16821682                } 
    16831683 
     1684                $query_vars_hash = md5( serialize( $this->query_vars ) ); 
     1685 
    16841686                // Category stuff 
    1685                 if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && !$this->parsed_tax_query ) { 
     1687                if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && $query_vars_hash != $this->query_vars_hash ) { 
    16861688                        $q['cat'] = ''.urldecode($q['cat']).''; 
    16871689                        $q['cat'] = addslashes_gpc($q['cat']); 
    16881690                        $cat_array = preg_split('/[,\s]+/', $q['cat']); 
     
    17361738                } 
    17371739 
    17381740                // Tag stuff 
    1739                 if ( '' != $q['tag'] && !$this->is_singular && !$this->parsed_tax_query ) { 
     1741                if ( '' != $q['tag'] && !$this->is_singular && $query_vars_hash != $this->query_vars_hash ) { 
    17401742                        if ( strpos($q['tag'], ',') !== false ) { 
    17411743                                $tags = preg_split('/[,\s]+/', $q['tag']); 
    17421744                                foreach ( (array) $tags as $tag ) { 
     
    18081810                        ); 
    18091811                } 
    18101812 
    1811                 $this->parsed_tax_query = true; 
     1813                $this->query_vars_hash = $query_vars_hash; 
    18121814 
    18131815                $this->tax_query = new WP_Tax_Query( $tax_query ); 
    18141816        }