WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 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 2 years ago.
even-better-patch.diff (1.0 KB) - added by wonderboymusic 2 years ago.

Download all attachments as: .zip

Change History (7)

wonderboymusic2 years ago

comment:1 scribu2 years ago

  • Description modified (diff)

comment:2 scribu2 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.

comment:3 scribu2 years ago

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

comment:4 nacin2 years ago

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

Incorporated this into the patch on #18614.

comment:5 nacin2 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.