Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#27362 closed defect (bug) (fixed)

Fix tag logic in WP_Query::get_queried_object()

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

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 13 years ago.

Download all attachments as: .zip

Change History (9)

#1 @wonderboymusic
13 years ago

  • Component GeneralQuery
  • Keywords has-patch needs-unit-tests needs-refresh added
  • Milestone Awaiting Review3.9

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

#2 @SergeyBiryukov
13 years ago

  • Milestone 3.93.8.2

Previously: #26627

#3 @wonderboymusic
13 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
13 years ago

  • Keywords needs-refresh removed
  • Resolutionfixed
  • Status newclosed

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
13 years ago

  • Keywords fixed-major added
  • Resolution fixed
  • Status closedreopened

Reopening, as it's milestoned for 3.8.2.

#6 @SergeyBiryukov
13 years ago

  • Keywords needs-unit-tests removed

#7 @nacin
12 years ago

  • Resolutionfixed
  • Status reopenedclosed

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
12 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.