I've been using a custom code shippit Thesistut (http://thesistut.com/2012/exclude-posts ... -category/) to exclude posts from children categories. this snippit worked fine in version 4.1.5, but after upgrading to 4.2 and adding it in the site breaks.
The code snippit goes into the functions.php file. It looks like this:
- Code: Select all
/* disable posts from child categories in main query */
add_filter('pre_get_posts','custom_csp_pre_get_posts',20,1);
function custom_csp_pre_get_posts($query) {
if(function_exists('is_main_query')) {
if($query->is_category && !$query->is_admin && !$query->is_preview && $query->is_main_query() && false == $query->query_vars['suppress_filters']) {
$cat = get_term_by( 'slug', $query->query_vars['category_name'], 'category');
$query->set('category__in',$cat->term_id);
}
}
return $query ;
}
I'd absolutely positively love to know how to fix it or barring that be able to download 4.1.5 and downgrade
