Blog

The Haycroft Media Blog covers all aspects of website design and development from the web browsers being used through to the standards that govern the world wide web. As a website design and development company, it is imperative that we keep abreast of all the latest news and happenings in our field, and here we present the major stories along with tutorials, tips and other web-programming related items.

Exclude categories from WordPress RSS

The Haycroft Media website uses a category for the flashy portfolio on the home page, which we want to hide from the WordPress RSS feed

There are various options for doing this all detailed in a nice simple tutorial at Web-Kreation.com. We opted for option 2: Exclude categories in your template’s functions.php file, which simply involved the addition of a few lines of code to the functions.php file (just change the category id to that of the one you wish to omit):

function myFeedExcluder($query) {
 if ($query->is_feed) {
   $query->set('cat','-12');
 }
return $query;
}
add_filter('pre_get_posts','myFeedExcluder');
[ Back ]
Posted on Tuesday, December 1st, 2009, Filed under php, rss, wordpress