Today I figured I would create a category that doesn’t appear on my main page, for testing out some ideas. So I searched google, as I usually would, for instructions to do this.
As usual, answers were forthcoming from the WordPress site itself. It was as simple as modifying index.php for the theme I use, and adding a line so The Loop skipped execution of the main body of the loop, if a category matched the exclusion. Fair enough.
But then I discovered that posts from the excluded category appeared in my rss feed. Not good. After much research, I found many posts from people wanting to know how to do this, but hardly any useful information.
It turns out it is quite simple to exclude a category from an rss feed – it’s done in much the same way as for the main page – editing The Loop. Only in this case, The Loop can be found buried in wp-includes/feed-rss2.php (and also feed-atom.php, feed-rdf.php, and feed-rss.php). Search for the line
<?php while( have_posts()) : the_post(); ?>
and directly after it, insert
<?php if (in_category(‘3’)) continue; ?>
if you want to exclude category id 3. Simple!