Make WordPress Core

Opened 8 years ago

Last modified 7 years ago

#38278 new enhancement

Only query taxonomies assigned to the post types being queried

Reported by: desrosj's profile desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Taxonomy Keywords: 2nd-opinion needs-patch
Focuses: Cc:

Description

While working on #31383 (Add WP_Tax_Query support to WP_User_Query), it was brought up that taxonomy queries do not check to see whether the requested taxonomies are registered to the requested post type.

Opening this ticket to discuss further. Should taxonomies always match the queried post_type?

From @boonebgorges on the other ticket:

Here's a way to frame the issue: are we likely to confuse developers if we allow (ie, don't throw errors for) queries like get_users( ... 'tax_query' => ... 'taxonomy=post_tag' )? Or get_posts( ... 'tax_query' => ... 'taxonomy=some_user_taxonomy' )? Or maybe these queries will just always end up empty? We should think through the possible confusions (or, maybe, lack thereof).

Change History (4)

#1 @desrosj
8 years ago

  • Component changed from Taxonomy to Query

#2 @desrosj
8 years ago

  • Keywords 2nd-opinion needs-patch dev-feedback added

#3 @desrosj
7 years ago

  • Keywords dev-feedback removed

#4 @desrosj
7 years ago

  • Component changed from Query to Taxonomy
Note: See TracTickets for help on using tickets.