Last active
December 16, 2015 06:49
-
-
Save paulgibbs/5394388 to your computer and use it in GitHub Desktop.
Change WordPress RSS feed output (i.e. exclude a category)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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