Ticket #16622: 16622.3.diff

File 16622.3.diff, 1.8 KB (added by markjaquith, 2 years ago)
Line 
1Index: wp-includes/query.php
2===================================================================
3--- wp-includes/query.php       (revision 17488)
4+++ wp-includes/query.php       (working copy)
5@@ -1231,13 +1231,13 @@
6        var $is_post_type_archive = false;
7 
8        /**
9-        * Whether the tax query has been parsed once.
10+        * Stores the ->query_vars state like md5(serialize( $this->query_vars ) ) so we know
11+        * whether we have to re-parse because something has changed
12         *
13         * @since 3.1.0
14         * @access private
15-        * @var bool
16         */
17-       var $parsed_tax_query = false;
18+       var $query_vars_hash = false;
19 
20        /**
21         * Resets query flags to false.
22@@ -1496,7 +1496,7 @@
23                                $this->is_date = true;
24                        }
25 
26-                       $this->parsed_tax_query = false;
27+                       $this->query_vars_hash = false;
28                        $this->parse_tax_query( $qv );
29 
30                        foreach ( $this->tax_query->queries as $tax_query ) {
31@@ -1682,7 +1682,7 @@
32                }
33 
34                // Category stuff
35-               if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && !$this->parsed_tax_query ) {
36+               if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && md5(serialize( $this->query_vars ) ) != $this->query_vars_hash ) {
37                        $q['cat'] = ''.urldecode($q['cat']).'';
38                        $q['cat'] = addslashes_gpc($q['cat']);
39                        $cat_array = preg_split('/[,\s]+/', $q['cat']);
40@@ -1736,7 +1736,7 @@
41                }
42 
43                // Tag stuff
44-               if ( '' != $q['tag'] && !$this->is_singular && !$this->parsed_tax_query ) {
45+               if ( '' != $q['tag'] && !$this->is_singular && md5(serialize( $this->query_vars ) ) != $this->query_vars_hash ) {
46                        if ( strpos($q['tag'], ',') !== false ) {
47                                $tags = preg_split('/[,\s]+/', $q['tag']);
48                                foreach ( (array) $tags as $tag ) {
49@@ -1808,7 +1808,7 @@
50                        );
51                }
52 
53-               $this->parsed_tax_query = true;
54+               $this->query_vars_hash = md5(serialize( $this->query_vars ) );
55 
56                $this->tax_query = new WP_Tax_Query( $tax_query );
57        }