Opened 14 years ago
Closed 14 years ago
#15161 closed defect (bug) (fixed)
categories aren't excluded by pre_get_posts
Reported by: | jorbin | Owned by: | scribu |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | blocker | Version: | 3.1 |
Component: | Query | Keywords: | needs-patch regression |
Focuses: | Cc: |
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.
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.