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 | 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' )
? Orget_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).