WordPress.org

Make WordPress Core

Changeset 17489


Ignore:
Timestamp:
03/02/2011 04:10:21 AM (7 years ago)
Author:
markjaquith
Message:

Reparse the taxonomy query if query vars change. fixes #16622 for trunk

File:
1 edited

Legend:

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

    r17455 r17489  
    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
    1239      */
    1240     var $parsed_tax_query = false;
     1239     */
     1240    var $query_vars_hash = false;
    12411241
    12421242    /**
     
    14971497            }
    14981498
    1499             $this->parsed_tax_query = false;
     1499            $this->query_vars_hash = false;
    15001500            $this->parse_tax_query( $qv );
    15011501
     
    16831683
    16841684        // Category stuff
    1685         if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && !$this->parsed_tax_query ) {
     1685        if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && md5(serialize( $this->query_vars ) ) != $this->query_vars_hash ) {
    16861686            $q['cat'] = ''.urldecode($q['cat']).'';
    16871687            $q['cat'] = addslashes_gpc($q['cat']);
     
    17371737
    17381738        // Tag stuff
    1739         if ( '' != $q['tag'] && !$this->is_singular && !$this->parsed_tax_query ) {
     1739        if ( '' != $q['tag'] && !$this->is_singular && md5(serialize( $this->query_vars ) ) != $this->query_vars_hash ) {
    17401740            if ( strpos($q['tag'], ',') !== false ) {
    17411741                $tags = preg_split('/[,\s]+/', $q['tag']);
     
    18091809        }
    18101810
    1811         $this->parsed_tax_query = true;
     1811        $this->query_vars_hash = md5(serialize( $this->query_vars ) );
    18121812
    18131813        $this->tax_query = new WP_Tax_Query( $tax_query );
Note: See TracChangeset for help on using the changeset viewer.