Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#19939 closed defect (bug) (duplicate)

is_post_type_archive doesn't work with Tax Query

Reported by: wonderboymusic Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3.1
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

same problem as here: #18614

queried_object clobbers the post_type query portion. $this->is_post_type_archive returns true and post_type is attainable from public query vars.

This breaks all over eMusic. as does the other ticket, have to check is_post_type_archive() && 'whatever' === get_query_var( 'post_type' ) vs is_post_type_archive( 'whatever' )

Attachments (2)

is-pta-patch.diff (583 bytes) - added by wonderboymusic 6 years ago.
even-better-patch.diff (1.0 KB) - added by wonderboymusic 6 years ago.

Download all attachments as: .zip

Change History (7)

#1 @scribu
6 years ago

  • Description modified (diff)

#2 @scribu
6 years ago

Regarding even-better-patch.diff, it's debatable: why shouldn't the category be the queried object?

In general, the idea of having a single "queried object" breaks down when you query by more than one criteria.

is-pta-patch.diff looks fine.

#3 @scribu
6 years ago

Actually, is-pta-patch.diff doesn't look fine, since in_array() returns a boolean, whereas array_intersect() returns an array.

#4 @nacin
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Incorporated this into the patch on #18614.

#5 @nacin
6 years ago

Looks like I glanced off of both approaches here, but might not have solved this. Let's consolidate efforts either way in #18614.

Note: See TracTickets for help on using tickets.