#16730 closed defect (bug) (fixed)
query_posts() problem with multiple tags since 3.1 update
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1.1 |
| Component: | General | Version: | 3.1 |
| Severity: | normal | Keywords: | |
| Cc: | amir@… |
Description (last modified by scribu)
When I upgraded to 3.1 this query stopped working.
Does NOT return any results in 3.1:
query_posts( 'cat=8&tag=featured+hotels-and-motels' );
Returns expected results in 3.1:
$args = array ( 'cat' => 8, 'tag_slug__and' => 'featured+hotels-and-motels', ); query_posts( $args );
Attachments (2)
Change History (20)
Caused by [17272], which added back the old processing, but didn't skip the new, global, processing.
I don't know if we can do it at this point, but having all taxonomies support '+' and ',' might be nice.
Re doubling:
The trouble is that after each call to parse_query(), 'tag_slug__and' and 'tag_slug__in' are populated again, without being reset.
Two ways of going about this:
- Reset them using $wp_query->query. This is the easiest way, but is a potential source of future bugs.
- Don't manipulate them at all; parse 'cat' and 'tag' directly into tax_query.
Actually, the first approach will cause bugs: say, if someone were to set 'category__and' on 'pre_get_posts', so nevermind that.
- Cc amir@… added
As per IRC convo confirming that the issue I reference here and in Support Forum is a related issue with failure of 'category__and' since 3.1 update.
comment:10
ryan — 2 years ago
Can we not do array_unique() on those like we do everywhere else?
comment:11
scribu — 2 years ago
I guess that will have to do.
comment:12
scribu — 2 years ago
- Resolution set to fixed
- Status changed from accepted to closed
So, for 'category', include_children is false. That's expected, since 'cat' is lame.
But, for 'post_tag', include_children is set to true. That shouldn't be.
comment:13
scribu — 2 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
comment:14
scribu — 2 years ago
Nevermind that last comment; include_children is ignored unless the taxonomy is hierarchical.
comment:15
ajsadeh — 2 years ago
I resolved my issue by changing the query to use an Advanced Taxonomy Query. Details are on the support forum.
comment:16
ryan — 2 years ago
- Resolution set to fixed
- Status changed from reopened to closed
comment:17
ryan — 2 years ago
comment:18
scribu — 2 years ago
Could we also get 16730.diff in?

3.1.1 for investigation.