Skip to content

Instantly share code, notes, and snippets.

@paulgibbs
Last active December 16, 2015 06:49
Show Gist options
  • Save paulgibbs/5394388 to your computer and use it in GitHub Desktop.
Save paulgibbs/5394388 to your computer and use it in GitHub Desktop.
Change WordPress RSS feed output (i.e. exclude a category)
<?php
function pg_change_rss_query( $query ) {
if ( ! $query->is_feed )
return $query;
// Excludes posts in the staff category from the current feed
$query->set( 'category_name', 'staff' );
return $query;
}
add_filter( 'pre_get_posts', 'pg_change_rss_query' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment