0

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?

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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