Exclude Categories from RSS Feed: How To This on WordPress

StevenWordPress

You may have certain categories on your WordPress blog that you want to display on your site, but that you want to exclude from your RSS feed.

First thing to do is getting the ID of the category you want to exclude from your WordPress feed. To do that, go to the Categories admin page and put your mouse over the category you want to exclude. If you take a look at the status bar of your web-browser, you’ll see the category ID.

Once you retrieved the category ID, you need to paste the following code in the functions.php file of your WordPress theme:

function dukeoRSSFilter($query) {
  if ($query->is_feed) {
    $query->set('cat','-5'); // Replace 5 by Category ID
  }
return $query;
}
add_filter('pre_get_posts','dukeoRSSFilter');

Learn how I made $33,543 online in the past 12 months.

Simply input your best email below to get started.

Learn how I made $33,543 online in the past 12 months.

Simply input your best email below to get started.

No thanks, I have enough money