Opened 16 months ago

Closed 15 months ago

Last modified 15 months ago

#19939 closed defect (bug) (duplicate)

is_post_type_archive doesn't work with Tax Query

Reported by: wonderboymusic Owned by:
Priority: normal Milestone:
Component: Post Types Version: 3.3.1
Severity: normal Keywords: has-patch
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 16 months ago.
even-better-patch.diff (1.0 KB) - added by wonderboymusic 16 months ago.

Download all attachments as: .zip

Change History (7)

  • Description modified (diff)

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.

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

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

Incorporated this into the patch on #18614.

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.