Opened 16 years ago
Closed 16 years ago
#15161 closed defect (bug) (fixed)
categories aren't excluded by pre_get_posts
| Reported by: | jorbin | Owned by: | scribu |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | Query | Version: | 3.1 |
| Severity: | blocker | Keywords: | needs-patch regression |
| Cc: | Focuses: |
Description
Using a filter such as:
function jorbin_exclude_category($query) {
if ( $query->is_feed || $query->is_home ) {
$query->set('cat', '-9,-2,-8,-25,-13');
}
return $query;
}
add_filter('pre_get_posts', 'jorbin_exclude_category');
Fails on trunk, but works on 3.0.1 . It sets the category properly, but the posts aren't filtered out, so I hesitate to blame #14494
Change History (6)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This is because all the taxonomy related queries are parsed in parse_query() and put into the 'taxonomy_query' query var.
PS: 'pre_get_posts' is an action, not a filter.