Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using Simply Exclude to make sure that certain categories do not show up on the home page and in the sites main feed, http://example.com/feed. However, excluding the category from the main feed also excludes posts from the category's feed, http://example.com/category/category-73/feed/. How do I get it so that the main feed has these categories excluded but the category's feed remains populated?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

It took me a while but I figured it out, I just placed this in mu functions.php file:

function remove_se_filters($query) {

  if($query->is_feed && $query->is_category){
    global $wp_filter;

    foreach($wp_filter['pre_get_posts'][999] as $key=>$filter){
      if(strpos($key, 'se_filters') !== false){
        unset($wp_filter['pre_get_posts'][999][$key]);
      }
    }
  }

  return $query;
}

add_filter('pre_get_posts','remove_se_filters');

I found that I couldn't use the remove filter function because I did not have access to the original class variable that was used to set the filter in the first place so going into the filer's global variable and unsetting the array manually was the next best option.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.