WordPress.org

Ready to get started?Download WordPress

Forums

Remove Categories from Feed (2 posts)

  1. triplemoons
    Member
    Posted 3 years ago #

    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)...

  2. triplemoons
    Member
    Posted 3 years ago #

    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');
    }

Topic Closed

This topic has been closed to new replies.

About this Topic