Changeset 17552
- Timestamp:
- 03/24/2011 04:07:24 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r17528 r17552 1239 1239 */ 1240 1240 var $query_vars_hash = false; 1241 1242 /** 1243 * Whether query vars have changed since the initial parse_query() call. Used to catch modifications to query vars made 1244 * via pre_get_posts hooks. 1245 * 1246 * @since 3.1.1 1247 * @access private 1248 */ 1249 var $query_vars_changed = true; 1241 1250 1242 1251 /** … … 1396 1405 $this->query_vars = $this->fill_query_vars($this->query_vars); 1397 1406 $qv = &$this->query_vars; 1407 $this->query_vars_changed = true; 1398 1408 1399 1409 if ( ! empty($qv['robots']) ) … … 1628 1638 $this->set_404(); 1629 1639 1640 $this->query_vars_hash = md5( serialize( $this->query_vars ) ); 1641 $this->query_vars_changed = false; 1642 1630 1643 do_action_ref_array('parse_query', array(&$this)); 1631 1644 } … … 1686 1699 1687 1700 // Category stuff 1688 if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && md5(serialize( $this->query_vars ) ) != $this->query_vars_hash) {1701 if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && $this->query_vars_changed ) { 1689 1702 $q['cat'] = ''.urldecode($q['cat']).''; 1690 1703 $q['cat'] = addslashes_gpc($q['cat']); … … 1740 1753 1741 1754 // Tag stuff 1742 if ( '' != $q['tag'] && !$this->is_singular && md5(serialize( $this->query_vars ) ) != $this->query_vars_hash) {1755 if ( '' != $q['tag'] && !$this->is_singular && $this->query_vars_changed ) { 1743 1756 if ( strpos($q['tag'], ',') !== false ) { 1744 1757 $tags = preg_split('/[,\s]+/', $q['tag']); … … 1812 1825 } 1813 1826 1814 $this->query_vars_hash = md5(serialize( $this->query_vars ) );1815 1816 1827 $this->tax_query = new WP_Tax_Query( $tax_query ); 1817 1828 } … … 1883 1894 $q = &$this->query_vars; 1884 1895 1896 // Fill again in case pre_get_posts unset some vars. 1885 1897 $q = $this->fill_query_vars($q); 1898 1899 // Set a flag if a pre_get_posts hook changed the query vars. 1900 $hash = md5( serialize( $this->query_vars ) ); 1901 if ( $hash != $this->query_vars_hash ) { 1902 $this->query_vars_changed = true; 1903 $this->query_vars_hash = $hash; 1904 } 1905 unset($hash); 1886 1906 1887 1907 // First let's clear some variables … … 2443 2463 2444 2464 $where .= ')'; 2465 } 2466 2467 // Parse the meta query again if query vars have changed. 2468 if ( $this->query_vars_changed ) { 2469 $meta_query_hash = md5( serialize( $q['meta_query'] ) ); 2470 $_meta_query = $q['meta_query']; 2471 unset( $q['meta_query'] ); 2472 _parse_meta_query( $q ); 2473 if ( md5( serialize( $q['meta_query'] ) ) != $meta_query_hash && is_array( $_meta_query ) ) 2474 $q['meta_query'] = array_merge( $_meta_query, $q['meta_query'] ); 2445 2475 } 2446 2476
Note: See TracChangeset
for help on using the changeset viewer.