WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#35619 closed defect (bug) (fixed)

Queried object and Query vars are not consistent when querying two custom taxonomies

Reported by: Chouby Owned by: boonebgorges
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.1
Component: Query Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

The queried object returns the first queried taxonomy (as expected) while the query vars $query->query_vars['taxonomy'] and $query->query_vars['term'] are unexpectedly related to the last queried taxonomy.

Attachments (2)

35619.patch (1.5 KB) - added by Chouby 5 years ago.
35619.2.patch (1.5 KB) - added by Chouby 5 years ago.

Download all attachments as: .zip

Change History (5)

@Chouby
5 years ago

#1 @Chouby
5 years ago

  • Keywords has-patch has-unit-tests added

Sorry the first patch has a syntax error in test. Submitting a second one.

Last edited 5 years ago by Chouby (previous) (diff)

@Chouby
5 years ago

#2 @boonebgorges
5 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Version set to 4.1

Good catch. It looks like query_vars used to be set to the first one, but I accidentally changed it in [29891].

#3 @boonebgorges
5 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 36484:

WP_Query taxonomy query vars should be set to first of multiple taxonomies.

This provides better parity with get_queried_object(), which will return the
first taxonomy/term matched by the current query.

[29891] introduced the abnormal behavior for the 'taxonomy' and 'term'
query vars.

Props Chouby.
Fixes #35619.

Note: See TracTickets for help on using tickets.