WordPress.org

Make WordPress Core

Opened 19 months ago

Closed 9 months ago

Last modified 9 months ago

#22043 closed defect (bug) (fixed)

Undocumented default of post_type parameter to WP_Query with taxonomy queries

Reported by: dbernar1 Owned by:
Milestone: WordPress.org Priority: normal
Severity: normal Version:
Component: WordPress.org site Keywords:
Focuses: 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 (5)

comment:1 dbernar119 months ago

  • 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: wonderboymusic18 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 dbernar118 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'.

comment:4 wonderboymusic9 months ago

  • Milestone changed from Awaiting Review to 3.7
  • Resolution set to fixed
  • Status changed from new to closed

comment:5 helen9 months ago

  • Component changed from Query to WordPress.org site
  • Milestone changed from 3.7 to WordPress.org
Note: See TracTickets for help on using tickets.