Opened 8 months ago

Last modified 7 months ago

#22043 new defect (bug)

Undocumented default of post_type parameter to WP_Query with taxonomy queries

Reported by: dbernar1 Owned by:
Priority: normal Milestone: Awaiting Review
Component: Query Version:
Severity: normal Keywords:
Cc:

Description

post_type parameter default depends on the is_tax attribute. This is not documented here: http://codex.wordpress.org/Class_Reference/WP_Query#Type_.26_Status_Parameters

If is_tax is true, and post_type is not provided, the default of 'any' kicks in, and if is_tax is not set, the default of 'post' kicks in.

Either it is a bug, or perhaps just the documentation needs to be updated.

Please let me know what you think.

Thank you for sharing your software.

Change History (3)

  • Summary changed from WP_Query::is_tax true even when I am not really on a taxonomy page, but rather querying a taxonomy to Undocumented default of post_type parameter to WP_Query with taxonomy queries

comment:2 follow-up: ↓ 3   wonderboymusic7 months ago

  • Keywords reporter-feedback added

Your link points at the Status Parameters docs - did you mean status or post_type? And can you include some code that matches your use case / bug scenario?

comment:3 in reply to: ↑ 2   dbernar17 months ago

  • Keywords reporter-feedback removed

Replying to wonderboymusic:

Your link points at the Status Parameters docs - did you mean status or post_type? And can you include some code that matches your use case / bug scenario?

It seems that the fragment structure on that page changed.

http://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters is the link.

As for code, basically any WP_Query ( or query_posts and perhaps others) with a custom taxonomy specified, and without a post type specified. post_type WP_Query var will be 'any'.

Note: See TracTickets for help on using tickets.