Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#27362 closed defect (bug) (fixed)

Fix tag logic in WP_Query::get_queried_object()

Reported by: mattonomics's profile mattonomics Owned by:
Milestone: 3.8.2 Priority: normal
Severity: normal Version: 3.9
Component: Query Keywords: has-patch fixed-major
Focuses: Cc:

Description

Currently, the get_queried_object method in WP_Query has logic that correctly accounts for categories and other taxonomies, but not tags.

The attached patch simply includes the very simple logic so that tags may also be properly set up.

Attachments (1)

query.php.patch (778 bytes) - added by mattonomics 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @wonderboymusic
11 years ago

  • Component changed from General to Query
  • Keywords has-patch needs-unit-tests needs-refresh added
  • Milestone changed from Awaiting Review to 3.9

Thanks for the patch - we also need to roll tag vars into tax_query, I will get on that.

#2 @SergeyBiryukov
11 years ago

  • Milestone changed from 3.9 to 3.8.2

Previously: #26627

#3 @wonderboymusic
11 years ago

In 27511:

In WP_Query::get_queried_object(), account for pre_get_posts by checking for tag when tag_id isn't present. Tags still need to be rolled up into tax_query. Add a unit test confirming expected query vars during and after pre_get_posts.

Props mattonomics for a patch.
See #27362.

#4 @wonderboymusic
11 years ago

  • Keywords needs-refresh removed
  • Resolution set to fixed
  • Status changed from new to closed

Tags are already slurped up into tax_query, it just never populates query_vars since WP_Query has a member called tax_query. I looked into the redirect_canonical thing: isn't an issue, at all. Not sure where that outburst came from.

#5 @helen
11 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening, as it's milestoned for 3.8.2.

#6 @SergeyBiryukov
11 years ago

  • Keywords needs-unit-tests removed

#7 @nacin
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In [27647]:

In WP_Query::get_queried_object(), account for pre_get_posts by checking for tag when tag_id isn't present.
Merges [27511] to the 3.8 branch.

props mattonomics, wonderboymusic.
fixes #27362.

#8 @bcworkz
11 years ago

Related #27015. Issues remain using WP_Query::get_queried_object() in 'pre_get_posts' for single posts of any type and author archives.

Note: See TracTickets for help on using tickets.