Snippet to exclude a Category from WordPress Feed

function exclude_category($query) {
    if ( $query->is_feed ) {
        $query->set('cat', '-1, -2, -3');
    }
return $query;
}
add_filter('pre_get_posts', 'exclude_category');
0

Leave a Reply