Using a taxonomy query doesn't set the request type properly in WP_Query #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using a
taxQuery
in a query, the taxonomy relevant request type properties are not set correctly onWP_Query
. So for example when querying a category$wp_query->is_category
returnsfalse
even though it should betrue
. Or when combining a tag and category related query, e.g.both
$wp_query->is_tag
and$wp_query->is_category
should be true.This was caused because the the taxonomy queries were nested inside an additional array in
map_input_fields
which caused the functionality in https://github.com/WordPress/WordPress/blob/32d761ce7dc8429f07469fde36e96830edca48f1/wp-includes/class-wp-query.php#L885 not to trigger.The query worked fine though, but plugins relating on the request type failed.