Customized WordPress RSS Feed
Here’s a very simple hack to exclude items from an RSS feed, and since the principle involves the Loop, by extension, for post output as well - it’s not great programming style or practice but it does the job.
Exclude by author - any post you don’t want to appear on the RSS (maybe you’re a bit shy about sponsored posts…) assign to their own author.
You could also exclude by category, but the programming is slightly more complicated, since get_the_category() returns an array of objects
In, for example, wp-includes/feed-rss2.php
In the Loop: - while( have_posts()) : the_post();
add: if (get_the_author_ID() != 3){ // the chosen author ID to exclude
and don’t forget the closing } just before endwhile;
And, 3-4 months later, don’t forget to switch user…
In the same way, this is the first step towards setting up a featured posts category…












C. Douglas — April 22, 2008 @ 2:15 pm
Perfect timing on this one! I was going “loopy” in the middle of the night — forgot to close! Thanks once again!