• I need to remove 9 categories from my feed, however none of the options I’ve found work.

    if(empty($_SERVER['QUERY_STRING']) || (isset($_GET['feed']) && !(isset($_GET['cat']) || isset($_GET['category_name'])))) {
    $cat=-1;
    }
    function myFilter($query) {
        if ($query->is_feed) {
            $query->set('cat','-99');
        }
    return $query;
    }
    add_filter('pre_get_posts','myFilter');

    I’ve also tried two plugins (which I really don’t want to use plugisn to begin with)…

Viewing 1 replies (of 1 total)
  • Thread Starter triplemoons

    (@triplemoons)

    Seriously? No one?

    I also tried forcing it to show only a single category and all’s I get is a white screen.

    function my_cat_include($query) {
    if ($query->is_feed) {
    $query->set('cat','3');
    }
    return $query;
    }
    
    add_filter('pre_get_posts','my_cat_include');
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Remove Categories from Feed’ is closed to new replies.